コード例 #1
0
    /**
     *   this is the updated fucntion for the state
     */
    public override void Excute(GameObject CallingObject)
    {
        FieldPlayer PlayerScript = CallingObject.GetComponent <FieldPlayer>();

        if (PlayerScript.BallInReceivingRange() || !PlayerScript.GetTeam().InControl())
        {
            PlayerScript.ChangeState(CallingObject, ChaseBall.Instance());

            return;
        }

        Steer2D.Arrive Arr = (Steer2D.Arrive)PlayerScript.GetSteeringController().GetBehaviourByTypeName("Steer2D.Arrive");

        if (Arr.AtTarget)
        {
            //PlayerScript.ChangeState(CallingObject, Wait.Instance());
            //PlayerScript.GetSteeringController().TurnOff(Behaviour.Arrive);
            // PlayerScript.GetSteeringController().TurnOff(Behaviour.Pursue);
            PlayerScript.TrackBall();

            if (PlayerScript.IsClosestTeamMemberToBall())
            {
                PlayerScript.ChangeState(CallingObject, ChaseBall.Instance());
            }
        }
    }