protected void Start()
    {
        TurnOrder.RegisterUnit(this);
        m_Projectile = GetComponent <UnitProjectile>();
        float rotation = transform.rotation.eulerAngles.y;

        while (rotation < 0)
        {
            rotation += 360;
        }
        while (rotation > 360)
        {
            rotation -= 360;
        }
        if ((rotation <= 45 && rotation >= 0) || (rotation <= 360 && rotation > 315))
        {
            m_MovingDirection = E_Direction.North;
        }
        else if ((rotation > 45 && rotation <= 135))
        {
            m_MovingDirection = E_Direction.East;
        }
        else if ((rotation > 135 && rotation <= 225))
        {
            m_MovingDirection = E_Direction.South;
        }
        else
        {
            m_MovingDirection = E_Direction.West;
        }
    }
示例#2
0
 public void Attack(Item Target)
 {
     BattleSystemClient.Instance.AddActionForExecution(() =>
     {
         Vector3 _Target = new Vector3(Target.Position.x, 0f, Target.Position.y);
         _animator.transform.LookAt(_Target);
         UnitProjectile.Instantiate(_Target, _projectileParams);
         _animator.ResetTrigger("Attack");
         _animator.SetTrigger("Attack");
     });
 }