home *** CD-ROM | disk | FTP | other *** search
/ UnrealScript Game Programming All in One / UnrealScriptGameProgrammingAllInOne.iso / UGPAIOListings / UGPAIOListingsCh19 / CH19LIST / Classes / CH19_02LIST.uc < prev    next >
Encoding:
Text File  |  2006-02-25  |  2.0 KB  |  68 lines

  1. // %PARAMETERS = "CH19LIST C:\UT2004"
  2. //Identifies the package
  3. //CH19_02LIST.uc
  4.  
  5.  //#1
  6. //Preconditions:
  7. //This class tests CH19LIST.Element
  8.  
  9. class CH19_02LIST extends Commandlet;
  10. function int Main(string Args)
  11. {
  12.  //#2
  13.   local Element firstElement;
  14.   local Vector vect;
  15.   firstElement = new class'Element';
  16.  
  17.   Log(Chr(10)$ " Testing the Element class");
  18.  
  19.  //#3
  20.   //initialize element, don't set the direction
  21.   firstElement.setElement("None",                                  //direction
  22.                           "Electra",                               //character
  23.                           "Am I to make thy rule of honor mine?",  //speech
  24.                            101);                                   //element
  25.  
  26.   Log(Chr(10));
  27.   Log("  Direction not yet set:  [" $ firstElement.getDirection() $ "]");
  28.   Log(Chr(10));
  29.  
  30.   //set the direction
  31.   firstElement.setDirection("Still and angry.");
  32.  
  33.   //set the position
  34.   firstElement.setPosition(vect);
  35.  
  36.   //---------------------------------------------------
  37.  
  38.   //define the vector at this point
  39.   vect.x = 100;
  40.   vect.y = 100;
  41.   vect.z = 100;
  42.   
  43.   firstElement.setPosition(vect);
  44.  //#4
  45.   Log(" [" $ firstElement.getElementNum()$ "]");
  46.   Log(" [" $ firstElement.getDirection() $ "]");
  47.   Log(" "  $ Caps(firstElement.getElementName()) $ ":");
  48.   Log(" "  $ firstElement.getSpeech());
  49.  
  50.   //verify vector operations
  51.   vect = firstElement.getPosition();
  52.   Log("  Position:      " $ firstElement.getPosition() );
  53.   firstElement.setPositionXYZ(vect.x, vect.y, 120);
  54.   Log("  Move toward back:      " $ firstElement.getPosition() );
  55.  
  56.   //#5
  57.   firstElement.setElementNum(105);
  58.   firstElement.setDirection("Meek");
  59.   firstElement.setElementName("Chrysothemis");
  60.   firstElement.setSpeech("When thou art wise, then thou shalt guide us both.");
  61.   Log(Chr(10));
  62.   Log(" [" $ firstElement.getElementNum()$ "]");
  63.   Log(" [" $ firstElement.getDirection() $ "]");
  64.   Log(" "  $ Caps(firstElement.getElementName()) $ ":");
  65.   Log(" "  $ firstElement.getSpeech());
  66.   return 0;
  67. }
  68.