Exemplo n.º 1
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);
    }
    public override void Awake()
    {
        Debug.Log("Flee State Awake");
        if (_minionController.currentEnemy == null)
        {
            _minionController.currentEnemy = _minionController.SelectRandomEnemy().transform;
        }

        _flee  = new Flee(_minionController.transform, _minionController.currentEnemy.transform, _minionController.GetComponent <Rigidbody>(), 0.5f);
        _avoid = new Avoid(_minionController.transform, _minionController.lineOfSight.obstaclesLayer, _minionController.obstacleRadius, _minionController.obstacleWeight);
        _minionController.isFlee   = true; // Trigger Flee Bool.
        _minionController._speed   = _minionController._ogSpeed * 1.5f;
        _minionController.goneFlee = true;
        fleeTimer = 6f;

        if (_minionController.isBoss == true)
        {
            _minionController.AlertFlee();
        }
    }