Exemplo n.º 1
0
    /**
     *   this will execute when the state is entered
     */
    public override void Enter(GameObject CallingObject)
    {
        //Set as recieving and controlling player
        FieldPlayer PlayerScript = CallingObject.GetComponent <FieldPlayer>();

        PlayerScript.GetTeam().SetControllingPlayer(PlayerScript);
        PlayerScript.GetTeam().RecievingPlayer = PlayerScript;

        //TODO - maybe add more to this if statement
        //If player is close
        if (!PlayerScript.IsOppenentWithinRadius())
        {
            PlayerScript.GetSteeringController().TurnOn(Behaviour.Arrive);
        }
        else
        {
            PlayerScript.GetSteeringController().TurnOn(Behaviour.Pursue);

            Steer2D.Pursue Pur = (Steer2D.Pursue)PlayerScript.GetSteeringController().GetBehaviourByTypeName("Steer2D.Pursue");
            Pur.TargetAgent = PlayerScript.Ball;
        }

        if (PlayerScript.DebugOn)
        {
            Debug.Log("Entering recieve ball state");
        }
    }