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

        if (PlayerScript.BallInKickingRange())
        {
            PlayerScript.ChangeState(CallingObject, KickBall.Instance());

            return;
        }


        if (PlayerScript.IsClosestTeamMemberToBall())
        {
            Steer2D.Seek S = (Steer2D.Seek)PlayerScript.GetSteeringController().GetBehaviourByTypeName("Steer2D.Seek");

            if (S)
            {
                S.TargetPoint = PlayerScript.Ball.transform.position;
            }

            return;
        }

        PlayerScript.ChangeState(CallingObject, ReturnToHomeRegion.Instance());
    }
Exemple #2
0
    void setupSeek()
    {
        myAgent          = GetComponent <Steer2D.SteeringAgent> ();
        myAgent.CanSteer = false;

        seekController                 = GetComponent <Steer2D.Seek> ();
        seekController.SeekTarget      = playerMoose.gameObject.transform;
        seekController.enabled         = false;
        fleeController                 = GetComponent <Steer2D.Flee> ();
        fleeController.fleeTargetPoint = playerMoose.gameObject.transform;
        fleeController.FleeRadius      = minDistanceToPlayer;
        fleeController.enabled         = false;
    }