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