Exemple #1
0
    public override void Execute()
    {
        if (_timer > 0)
        {
            _timer -= Time.deltaTime;
        }

        else
        {
            // If Minion is BOSS
            if (_minionController.isBoss)
            {
                _fsm.Transition(MinionController.States.SEARCHING);
            }

            // If Minion is NOT BOSS
            else
            {
                if (_minionController.IsBossAlive() == true)
                {
                    _fsm.Transition(MinionController.States.FLOCKING);
                    return;
                }

                else
                {
                    if (_minionController.enemiesMinionList.Count > 0 && _minionController.IsBossAlive() == false)
                    {
                        _fsm.Transition(MinionController.States.PURSUIT);
                    }
                }
            }
        }
    }
Exemple #2
0
    public override void Awake()
    {
        Debug.Log("Pursuit State Awake");
        if (_minionController.IsBossAlive() == false)
        {
            _enemyController = _minionController.SelectRandomEnemy();
            _enemyTransform  = _enemyController.transform;
        }

        _enemyTransform = _minionController.currentEnemy;

        if (_enemyTransform == null || _enemyController == null)
        {
            _enemyController = _minionController.SelectRandomEnemy();
            _enemyTransform  = _enemyController.transform;
        }

        _enemyController = _enemyTransform.GetComponent <MinionController>();

        avoid = new Avoid(_minionController.transform, _minionController.lineOfSight.obstaclesLayer, _minionController.obstacleRadius, _minionController.obstacleWeight);
        avoid.SetTarget(_enemyTransform);
    }