/** * this is the updated fucntion for the state */ public override void Excute(GameObject CallingObject) { FieldPlayer PlayerScript = CallingObject.GetComponent <FieldPlayer>(); PlayerScript.TrackBall(); if (PlayerScript.GetTeam().GetPitch().GetGameInPlay()) { //If closest to ball and not in goalkeepers hands... Chase the ball if (PlayerScript.IsClosestTeamMemberToBall() && (!PlayerScript.GetTeam().GetPitch().GoalKeeperHasBall())) { PlayerScript.ChangeState(CallingObject, ChaseBall.Instance()); return; } } if (PlayerScript.GetTeam().InControl() && (PlayerScript.GetTeam().ControllingPlayer != PlayerScript && PlayerScript.AheadOfAttacker())) { PlayerScript.GetTeam().RequestPass(CallingObject); return; } }