Esempio n. 1
0
    protected void SetupAgentLocomotion()
    {
        if (AgentDone())
        {
            AvatarLocomotion.Do(0, 0);
        }
        else
        {
            float speed = agent.desiredVelocity.magnitude;

            Vector3 velocity = Quaternion.Inverse(transform.rotation) * agent.desiredVelocity;
            float   angle    = Mathf.Atan2(velocity.x, velocity.z) * 180.0f / Mathf.PI;

            AvatarLocomotion.Do(speed, angle);
        }


        SetDestination(target.TransformPoint(offset));
    }
Esempio n. 2
0
    protected void SetupAgentLocomotion()
    {
        if (AgentDone())
        {
            AvatarLocomotion.Do(0, 0);
            SpawningPoint[] orderd = sps.OrderBy(x => Vector3.Distance(x.transform.position, transform.position)).ToArray();

            target = orderd [Random.Range(1, orderd.Length)].transform;
            SetDestination(target.position);
        }
        else
        {
            float speed = agent.desiredVelocity.magnitude;

            Vector3 velocity = Quaternion.Inverse(transform.rotation) * agent.desiredVelocity;
            float   angle    = Mathf.Atan2(velocity.x, velocity.z) * 180.0f / Mathf.PI;

            AvatarLocomotion.Do(speed, angle);
        }
    }
 void Awake()
 {
     locomotion = GetComponent<AvatarLocomotion>();
     controller = GameObject.FindGameObjectWithTag(Tags.BattlegroundController).GetComponent<BattlegroundController>();
 }