Exemplo n.º 1
0
    public override FiniteState CheckState()
    {
        if (_homer.GetTooCloseEnemies().Exists((Enemy e) => e.gameObject != _homer.capturer))
        {
            _homer.capturer = null;
            return(_escape);
        }

        _steeringController.Steer();

        return(this);
    }
Exemplo n.º 2
0
    public override FiniteState CheckState()
    {
        List <Enemy> tooCloseEnemies = _homer.GetTooCloseEnemies();

        if (tooCloseEnemies.Count == 0)
        {
            return(_wander);
        }

        _steeringController.SetBehaviours(
            tooCloseEnemies.ConvertAll <SteeringBehaviour>(
                (e) => new SteerFromTarget(this.gameObject.transform, e.transform)
                )
            );

        _steeringController.AddBehaviours(new SteerAvoidBuildings(this.transform));

        _steeringController.Steer();

        return(this);
    }