public override void OnStart() { //Get the agent, ball and team component agent = GetComponent <SoccerAgent>(); Ball = agent.getBall().GetComponent <Ball>(); isLeft = agent.WhichTeam(); }
public override void OnStart() { agent = GetComponent <SoccerAgent>(); ballLoaction = agent.getBall().transform; //Get the location of the Agent itself InitPos = agent.transform.position; //Set up patrol points PatrolPositions.Add(new Vector3(InitPos.x, InitPos.y, InitPos.z + Define.Patrol_Circle)); PatrolPositions.Add(new Vector3(InitPos.x, InitPos.y, InitPos.z - Define.Patrol_Circle)); //Choose a patrol point close to float distance = Mathf.Infinity; //Distance difference between agent and the patrol point float localDistance; for (int i = 0; i < PatrolPositions.Count; ++i) { if ((localDistance = Vector3.Magnitude(agent.transform.position - PatrolPositions[i])) < distance) { distance = localDistance; index = i; } } PatrolPos = PatrolPositions[index]; agent.setDestination(PatrolPos); }
public override void OnStart() { mAgent = GetComponent <SoccerAgent>(); isLeft = mAgent.WhichTeam(); ballLoaction = mAgent.getBallPosition(); ball = mAgent.getBall().GetComponent <Ball>(); }
public override void OnStart() { Ball = Agent.getBall().GetComponent <Ball>(); isLeft = Agent.WhichTeam(); Agent = GetComponent <SoccerAgent>(); originPos = Agent.transform.position; }
public override void OnStart() { Agent = GetComponent <SoccerAgent>(); Ball = Agent.getBall().GetComponent <Ball>(); isLeft = Agent.WhichTeam(); }
void Start() { agent = GetComponent <SoccerAgent>(); Ball = agent.getBall().GetComponent <Ball>(); isLeft = agent.WhichTeam(); }