コード例 #1
0
 void Update()
 {
     if (_entity.IsSpawned)
     {
         _agent.speed = _entity.MovementSpeed;
         CombatUtils.MoveToAggroTarget(_entity, _aggro.Target, this);
     }
 }
コード例 #2
0
    void Update()
    {
        CombatUtils.MoveToAggroTarget(_entity, _aggro.Target, this);

        if (_isNavigating)
        {
            Vector3 dir      = (_destination - transform.position).normalized;
            Vector3 velocity = dir * _entity.MovementSpeed * Time.deltaTime;

            // Ignore Y position for flying units.
            velocity.y = 0f;

            transform.position += velocity;
        }
    }