private void SetupChooseTargetSequence(Script_Sequence p_chooseTargetSequence) { Script_Action_SetFlag setEnemies = new Script_Action_SetFlag(_behaviourTree, _manager.GetEnemies(), _entityListFlag); Script_Action_SetEntitiesWithinRange setEnemiesWithinRange = new Script_Action_SetEntitiesWithinRange(_behaviourTree, _grid, _entityListFlag, _entityListFlag, this as Script_IEntity, _engageTargetRange); Script_Action_SetNearestEntityFromEntityWithinRange setNearestEnemy = new Script_Action_SetNearestEntityFromEntityWithinRange(_behaviourTree, _grid, _entityListFlag, _engageTargetRange, this as Script_IEntity, _targetEntityFlag); Script_Action_SetEnemyAttackingTarget setEnemyAttackingDps = new Script_Action_SetEnemyAttackingTarget(_behaviourTree, _entityListFlag, _manager.GetDps() as Script_IEntity, _targetEntityFlag); Script_Action_SetEnemyAttackingTarget setEnemyAttackingHealer = new Script_Action_SetEnemyAttackingTarget(_behaviourTree, _entityListFlag, _manager.GetHealer() as Script_IEntity, _targetEntityFlag); Script_Selector chooseTargetToAidSelector = new Script_Selector(_behaviourTree); Script_LeafTask setEnemiesLeaf = new Script_LeafTask(_behaviourTree, setEnemies); Script_LeafTask setEnemiesWithinRangeLeaf = new Script_LeafTask(_behaviourTree, setEnemiesWithinRange); Script_LeafTask setNearestEnemyLeaf = new Script_LeafTask(_behaviourTree, setNearestEnemy); Script_LeafTask setEnemyAttackingHealerLeaf = new Script_LeafTask(_behaviourTree, setEnemyAttackingHealer); Script_LeafTask setEnemyAttackingDpsLeaf = new Script_LeafTask(_behaviourTree, setEnemyAttackingDps); chooseTargetToAidSelector.AddTask(setEnemyAttackingHealerLeaf); chooseTargetToAidSelector.AddTask(setEnemyAttackingDpsLeaf); p_chooseTargetSequence.AddTask(setEnemiesLeaf); p_chooseTargetSequence.AddTask(setEnemiesWithinRangeLeaf); p_chooseTargetSequence.AddTask(setNearestEnemyLeaf); p_chooseTargetSequence.AddTask(chooseTargetToAidSelector); }
private void SetupGetFreeSpaceSequence(Script_Sequence p_getFreeSpaceSequence) { int range = 1; Script_Action_SetFlag setEnemies = new Script_Action_SetFlag(_behaviourTree, _manager.GetEnemies(), _getSpaceEntityListFlag); Script_Action_SetEntitiesWithinRange setEnemiesWithinRange = new Script_Action_SetEntitiesWithinRange(_behaviourTree, _grid, _getSpaceEntityListFlag, _getSpaceEntityListFlag, this as Script_IEntity, range); Script_Condition_AreAnyEntitiesAtEntityLocation isEnemyAtLocation = new Script_Condition_AreAnyEntitiesAtEntityLocation(_behaviourTree, _getSpaceEntityListFlag, this as Script_IEntity); Script_Action_SetFlag setFlagToSelf = new Script_Action_SetFlag(_behaviourTree, this as Script_IEntity, _selfFlag); Script_Action_UnoccupyTile unoccupyTile = new Script_Action_UnoccupyTile(_behaviourTree, _grid, _locationFlag); Script_Action_SetNearestLocationSurroundingEntity getLocationAroundSelf = new Script_Action_SetNearestLocationSurroundingEntity(_behaviourTree, _grid, _selfFlag, this as Script_IEntity, _locationFlag); Script_Action_OccupyTile occupyTile = new Script_Action_OccupyTile(_behaviourTree, _grid, _locationFlag); Script_Action_MoveToLocation moveToLocation = new Script_Action_MoveToLocation(_behaviourTree, this as Script_IEntity, _locationFlag); Script_LeafTask setEnemiesLeaf = new Script_LeafTask(_behaviourTree, setEnemies); Script_LeafTask setEnemiesWithinRangeLeaf = new Script_LeafTask(_behaviourTree, setEnemiesWithinRange); Script_LeafTask isEnemyAtLocationLeaf = new Script_LeafTask(_behaviourTree, isEnemyAtLocation); Script_LeafTask setFlagToSelfLeaf = new Script_LeafTask(_behaviourTree, setFlagToSelf); Script_LeafTask unoccupyTileLeaf = new Script_LeafTask(_behaviourTree, unoccupyTile); Script_LeafTask getLocationAroundSelfLeaf = new Script_LeafTask(_behaviourTree, getLocationAroundSelf); Script_LeafTask occupyTileLeaf = new Script_LeafTask(_behaviourTree, occupyTile); Script_LeafTask moveToLocationleaf = new Script_LeafTask(_behaviourTree, moveToLocation); Script_Decorator_NeverSucceed moveToLocationAndNeverSucceedDecorator = new Script_Decorator_NeverSucceed(_behaviourTree, moveToLocationleaf); p_getFreeSpaceSequence.AddTask(setEnemiesLeaf); p_getFreeSpaceSequence.AddTask(setEnemiesWithinRangeLeaf); p_getFreeSpaceSequence.AddTask(isEnemyAtLocationLeaf); p_getFreeSpaceSequence.AddTask(setFlagToSelfLeaf); p_getFreeSpaceSequence.AddTask(unoccupyTileLeaf); p_getFreeSpaceSequence.AddTask(getLocationAroundSelfLeaf); p_getFreeSpaceSequence.AddTask(occupyTileLeaf); p_getFreeSpaceSequence.AddTask(moveToLocationAndNeverSucceedDecorator); }
private void SetupChooseTargetToAttackSequence(Script_Sequence p_chooseTargetSequence) { Script_Action_SetFlag setEnemies = new Script_Action_SetFlag(_behaviourTree, _manager.GetEnemies(), _entityListFlag); Script_Action_SetEntitiesWithinRange setEnemiesWithinRange = new Script_Action_SetEntitiesWithinRange(_behaviourTree, _grid, _entityListFlag, _entityListFlag, this as Script_IEntity, _attackRange); Script_Action_SetEntityWithLowestHealth setEnemyWithLowestHealth = new Script_Action_SetEntityWithLowestHealth(_behaviourTree, _entityListFlag, _targetEntityFlag); Script_LeafTask setEnemiesLeaf = new Script_LeafTask(_behaviourTree, setEnemies); Script_LeafTask setEnemiesWithinRangeLeaf = new Script_LeafTask(_behaviourTree, setEnemiesWithinRange); Script_LeafTask setEnemyWithLowestHealthLeaf = new Script_LeafTask(_behaviourTree, setEnemyWithLowestHealth); Script_Decorator_AlwaysFail setEnemyWithLowestHealthAndFailDecorator = new Script_Decorator_AlwaysFail(_behaviourTree, setEnemyWithLowestHealthLeaf); p_chooseTargetSequence.AddTask(setEnemiesLeaf); p_chooseTargetSequence.AddTask(setEnemiesWithinRangeLeaf); p_chooseTargetSequence.AddTask(setEnemyWithLowestHealthAndFailDecorator); }