コード例 #1
0
    private void SetupPursuitSequence(Script_Sequence p_pursuitSequence)
    {
        Script_Action_UnoccupyTile      unoccupyTile      = new Script_Action_UnoccupyTile(_behaviourTree, _grid, _locationFlag);
        Script_Action_MoveTowardsEntity moveTowardsTarget = new Script_Action_MoveTowardsEntity(_behaviourTree, _grid, _targetEntityFlag, this as Script_IEntity);
        Script_Action_SetNearestLocationSurroundingEntity setLocationAroundTarget = new Script_Action_SetNearestLocationSurroundingEntity(_behaviourTree, _grid, _targetEntityFlag, this as Script_IEntity, _locationFlag);
        Script_Action_MoveToLocation moveToLocation = new Script_Action_MoveToLocation(_behaviourTree, this as Script_IEntity, _locationFlag);
        Script_Action_OccupyTile     occupyTile     = new Script_Action_OccupyTile(_behaviourTree, _grid, _locationFlag);

        Script_Condition_IsEntityNull   isTargetNull     = new Script_Condition_IsEntityNull(_behaviourTree, _targetEntityFlag);
        Script_Condition_IsEntityNearby isTargetAdjacent = new Script_Condition_IsEntityNearby(_behaviourTree, _grid, _targetEntityFlag, this as Script_IEntity, _attackRange);

        Script_LeafTask isTargetNullLeaf            = new Script_LeafTask(_behaviourTree, isTargetNull);
        Script_LeafTask isTargetAdjacentLeaf        = new Script_LeafTask(_behaviourTree, isTargetAdjacent);
        Script_LeafTask occupyTileLeaf              = new Script_LeafTask(_behaviourTree, occupyTile);
        Script_LeafTask unoccupyTileLeaf            = new Script_LeafTask(_behaviourTree, unoccupyTile);
        Script_LeafTask moveTowardsTargetLeaf       = new Script_LeafTask(_behaviourTree, moveTowardsTarget);
        Script_LeafTask setLocationAroundTargetLeaf = new Script_LeafTask(_behaviourTree, setLocationAroundTarget);
        Script_LeafTask moveToLocationLeaf          = new Script_LeafTask(_behaviourTree, moveToLocation);

        Script_Decorator_Inverter isTargetNotAdjacentDecorator = new Script_Decorator_Inverter(_behaviourTree, isTargetAdjacentLeaf);
        Script_Decorator_Inverter isTargetNotNullDecorator     = new Script_Decorator_Inverter(_behaviourTree, isTargetNullLeaf);

        p_pursuitSequence.AddTask(isTargetNotNullDecorator);
        p_pursuitSequence.AddTask(isTargetNotAdjacentDecorator);
        p_pursuitSequence.AddTask(unoccupyTileLeaf);
        p_pursuitSequence.AddTask(moveTowardsTargetLeaf);
        p_pursuitSequence.AddTask(setLocationAroundTargetLeaf);
        p_pursuitSequence.AddTask(occupyTileLeaf);
        p_pursuitSequence.AddTask(moveToLocationLeaf);
    }
コード例 #2
0
    private void SetupMoveToTankSequence(Script_Sequence p_moveNearTankSequence)
    {
        Script_Action_SetFlag      setTankFlag  = new Script_Action_SetFlag(_behaviourTree, _manager.GetTank() as Script_IEntity, _entityToFollowFlag);
        Script_Action_UnoccupyTile unoccupyTile = new Script_Action_UnoccupyTile(_behaviourTree, _grid, _locationFlag);
        Script_Action_SetNearestLocationSurroundingEntity setLocationNearTank = new Script_Action_SetNearestLocationSurroundingEntity(_behaviourTree, _grid, _entityToFollowFlag, 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_Condition_IsEntityNull isTankNull = new Script_Condition_IsEntityNull(_behaviourTree, _entityToFollowFlag);

        Script_LeafTask setTankFlagLeaf         = new Script_LeafTask(_behaviourTree, setTankFlag);
        Script_LeafTask isTankNullLeaf          = new Script_LeafTask(_behaviourTree, isTankNull);
        Script_LeafTask unoccupyTileLeaf        = new Script_LeafTask(_behaviourTree, unoccupyTile);
        Script_LeafTask setLocationNearTankLeaf = new Script_LeafTask(_behaviourTree, setLocationNearTank);
        Script_LeafTask occupyTileLeaf          = new Script_LeafTask(_behaviourTree, occupyTile);
        Script_LeafTask moveToLocationLeaf      = new Script_LeafTask(_behaviourTree, moveToLocation);

        Script_Decorator_Inverter isTankNotNullDecorator = new Script_Decorator_Inverter(_behaviourTree, isTankNullLeaf);

        p_moveNearTankSequence.AddTask(setTankFlagLeaf);
        p_moveNearTankSequence.AddTask(isTankNotNullDecorator);
        p_moveNearTankSequence.AddTask(unoccupyTileLeaf);
        p_moveNearTankSequence.AddTask(setLocationNearTankLeaf);
        p_moveNearTankSequence.AddTask(occupyTileLeaf);
        p_moveNearTankSequence.AddTask(moveToLocationLeaf);
    }
コード例 #3
0
    private void SetupAttackSequence(Script_Sequence p_attackSequence)
    {
        Script_Condition_IsEntityNearby isTargetNearby      = new Script_Condition_IsEntityNearby(_behaviourTree, _grid, _targetToAttackFlag, this as Script_IEntity, _attackRange);
        Script_Action_SetFlag           setForwardSwingFlag = new Script_Action_SetFlag(_behaviourTree, false, _isForwardSwingingFlag);
        Script_Action_RangedAttack      attackTarget        = new Script_Action_RangedAttack(_behaviourTree, _manager, _targetToAttackFlag, _locationFlag, this as Script_IEntity, _isForwardSwingingFlag, Color.green);
        Script_Condition_IsEntityNull   isTargetNull        = new Script_Condition_IsEntityNull(_behaviourTree, _targetToAttackFlag);

        Script_LeafTask           isTargetNullLeaf         = new Script_LeafTask(_behaviourTree, isTargetNull);
        Script_Decorator_Inverter isTargetNotNullDecorator = new Script_Decorator_Inverter(_behaviourTree, isTargetNullLeaf);
        Script_LeafTask           isTargetNearbyLeaf       = new Script_LeafTask(_behaviourTree, isTargetNearby);
        Script_LeafTask           setForwardSwingFlagLeaf  = new Script_LeafTask(_behaviourTree, setForwardSwingFlag);
        Script_LeafTask           attackTargetLeaf         = new Script_LeafTask(_behaviourTree, attackTarget);

        p_attackSequence.AddTask(isTargetNotNullDecorator);
        p_attackSequence.AddTask(isTargetNearbyLeaf);
        p_attackSequence.AddTask(setForwardSwingFlagLeaf);
        p_attackSequence.AddTask(attackTargetLeaf);
    }
コード例 #4
0
    private void SetupHealSequence(Script_Sequence p_healSequence)
    {
        int healThreshold = 80;

        Script_Condition_IsEntityHealthUnderThreshold isTargetUnderHealthValue = new Script_Condition_IsEntityHealthUnderThreshold(_behaviourTree, _targetToHealFlag, healThreshold);
        Script_Condition_IsEntityNearby isTargetToHealNearby = new Script_Condition_IsEntityNearby(_behaviourTree, _grid, _targetToHealFlag, this as Script_IEntity, _attackRange);
        Script_Action_SetFlag           forwardSwingFlag     = new Script_Action_SetFlag(_behaviourTree, false, _isForwardSwingingFlag);
        Script_Action_Heal            healTarget             = new Script_Action_Heal(_behaviourTree, _manager, _targetToHealFlag, _locationFlag, this as Script_IEntity, _isForwardSwingingFlag);
        Script_Condition_IsEntityNull isTargetNull           = new Script_Condition_IsEntityNull(_behaviourTree, _targetToHealFlag);

        Script_LeafTask           isTargetNullLeaf             = new Script_LeafTask(_behaviourTree, isTargetNull);
        Script_Decorator_Inverter isTargetNotNullDecorator     = new Script_Decorator_Inverter(_behaviourTree, isTargetNullLeaf);
        Script_LeafTask           IsTargetUnderHealthValueLeaf = new Script_LeafTask(_behaviourTree, isTargetUnderHealthValue);
        Script_LeafTask           isTargetToHealNearbyLeaf     = new Script_LeafTask(_behaviourTree, isTargetToHealNearby);
        Script_LeafTask           SetForwardSwingFlagLeaf      = new Script_LeafTask(_behaviourTree, forwardSwingFlag);
        Script_LeafTask           healTargetLeaf = new Script_LeafTask(_behaviourTree, healTarget);

        p_healSequence.AddTask(isTargetNotNullDecorator);
        p_healSequence.AddTask(IsTargetUnderHealthValueLeaf);
        p_healSequence.AddTask(isTargetToHealNearbyLeaf);
        p_healSequence.AddTask(SetForwardSwingFlagLeaf);
        p_healSequence.AddTask(healTargetLeaf);
    }