Example #1
0
    //Private methods
    private void UpdateAiStates()
    {
        if (player.IsMyBall())           //Estados de Jogador com a bola
        {
            if (SelectedAIState != AIWithBall)
            {
                SelectedAIState.StopHandleStates();
                SelectedAIState = AIWithBall;
            }

            SelectedAIState.ToWithBall().checkTimeToDrible     = timeTodrible;
            SelectedAIState.ToWithBall().checkDistanceToDrible = distanceToDrible;
            SelectedAIState.ToWithBall().checkDistanceToPass   = distanceToPass;
        }
        else if (player.IsSelected())    //Estados de jogador sem bola mas selecionado
        {
            if (SelectedAIState != AISelected)
            {
                SelectedAIState.StopHandleStates();
                SelectedAIState = AISelected;
            }
        }
        else                            //Estado jogador sem bola e não selecionado
        {
            if (SelectedAIState != AIUnselected)
            {
                SelectedAIState.StopHandleStates();
                SelectedAIState = AIUnselected;
            }
        }

        SelectedAIState.UpdateHandleStates();
    }
Example #2
0
    //Unity Events
    private void OnEnable()
    {
        SelectedAIState = AIUnselected;
        AIUnselected.StopHandleStates();

        SignEvents();
    }
Example #3
0
    private AIController AiToPass = null; //Player que vai receber algum lance de passe


    private void Awake()
    {
        //NavMesh.avoidancePredictionTime = 10.0f;

        player = GetComponent <PlayerController>();
        agent  = GetComponent <NavMeshAgent>();
        agent.updateRotation = false;
        //agent.updatePosition = false;

        AIUnselected = new SoccerAIUnSelected(this, player);
        AISelected   = new SoccerAISelected(this, player);
        AIWithBall   = new SoccerAIwithBall(this, player);

        nvSpeed        = agent.speed;
        nvAngularSpeed = agent.angularSpeed;
        nvAceleration  = agent.acceleration;

        SelectedAIState = AIUnselected;

        //SignEvents();
    }
 public static SoccerAIwithBall ToWithBall(this SoccerAIGeneric generic)
 {
     return((SoccerAIwithBall)generic);
 }
 public static SoccerAISelected ToSelected(this SoccerAIGeneric generic)
 {
     return((SoccerAISelected)generic);
 }