Ejemplo n.º 1
0
 public override void OnStart()
 {
     //Get the agent, ball and team component
     agent  = GetComponent <SoccerAgent>();
     Ball   = agent.getBall().GetComponent <Ball>();
     isLeft = agent.WhichTeam();
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public override void OnStart()
 {
     mAgent       = GetComponent <SoccerAgent>();
     isLeft       = mAgent.WhichTeam();
     ballLoaction = mAgent.getBallPosition();
     ball         = mAgent.getBall().GetComponent <Ball>();
 }
Ejemplo n.º 4
0
 public override void OnStart()
 {
     Ball      = Agent.getBall().GetComponent <Ball>();
     isLeft    = Agent.WhichTeam();
     Agent     = GetComponent <SoccerAgent>();
     originPos = Agent.transform.position;
 }
Ejemplo n.º 5
0
 public override void OnStart()
 {
     Agent  = GetComponent <SoccerAgent>();
     Ball   = Agent.getBall().GetComponent <Ball>();
     isLeft = Agent.WhichTeam();
 }
Ejemplo n.º 6
0
 void Start()
 {
     agent  = GetComponent <SoccerAgent>();
     Ball   = agent.getBall().GetComponent <Ball>();
     isLeft = agent.WhichTeam();
 }