Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 |
//===================================================================== // Tests Tyrion resources functionality //===================================================================== class TyrionResourcesTest extends TyrionUnitTest; //===================================================================== // Variables var() name pawnName; var AI_CharacterResource characterResource; var AI_MovementResource movementResource; var AI_WeaponResource weaponResource; var AI_Goal goal1; var AI_Goal goal2; var AI_Goal goal3; //===================================================================== // State Code state UnitTestState { function BeginState() { workPawn = getPawn(string(pawnName)); // get specified pawn if (workPawn == None) { signalFailed("Failed to find Pawn named " $ string(pawnName) $ "."); return; } characterResource = AI_CharacterResource(workPawn.characterAI); movementResource = AI_MovementResource(workPawn.movementAI); weaponResource = AI_WeaponResource(workPawn.weaponAI); // get AI controller workController = AI_Controller(workPawn.Controller); if (workController == None) { signalFailed(string(pawnName) $ " does not have an AI_Controller."); return; } characterResource.addAbility( new class'AI_TestCharacterD' ); characterResource.addAbility( new class'AI_TestCharacterE' ); movementResource.addAbility( new class'AI_TestMovementA' ); movementResource.addAbility( new class'AI_TestMovementB' ); weaponResource.addAbility( new class'AI_TestWeaponA' ); } Begin: logTest("Tyrion Resources Test started"); log("1. Starting a character action (AI_TestCharacterD) that uses arms and legs"); goal1 = (new class'AI_TestCharacterGoalB'( characterResource, 50 )).postGoal( None ); Sleep(3.0); log("2. Posting a high priority goal for the legs"); // AI_TestCharacterD should have its leg resource stolen and terminate) goal2 = (new class'AI_TestMovementGoalA'( movementResource, 90 )).postGoal( None ); // remove goal1 if the action achieving it fails loop1: if( !goal1.hasCompleted() ) { Sleep(0.5); goto 'loop1'; } if( !goal1.wasAchieved() ) { log( " AI_TestCharacterD was 'unposted'" ); goal1.unPostGoal( None ); } log("3. Starting another character action (AI_TestCharacterE) that uses only weapons"); // there should be no resource conflicts goal3 = (new class'AI_TestCharacterGoalC'( characterResource, 50 )).postGoal( None ); loop2: if ( !goal2.hasCompleted() || !goal3.hasCompleted() ) { Sleep(1.0); goto 'loop2'; } logTest("Tyrion Resources Test finished"); if ( !goal1.wasAchieved() && goal2.wasAchieved() && goal3.wasAchieved()) signalPassed(); else signalFailed(string(pawnName) $ " achieved " $ goal1 $ " or didn't achieve " $ goal2 $ " and " $ goal3); } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |