示例#1
0
 void HandleTouch(TouchSide touchSide, TouchType touchType)
 {
     if (SignalTouch != null)
     {
         SignalTouch(touchSide, touchType);
     }
 }
示例#2
0
 public bool GetIsPressed(TouchSide touchSide)
 {
     if (touchSide == TouchSide.Left)
     {
         return(leftTouchZone.uiItem.IsPressed);
     }
     if (touchSide == TouchSide.Right)
     {
         return(rightTouchZone.uiItem.IsPressed);
     }
     Debug.LogWarning("invalid touch zone type");
     return(false);
 }
示例#3
0
    void HandleTouch(TouchSide touchSide, TouchType touchType)
    {
        if (touchSide == TouchSide.Left)
        {
            if (touchType == TouchType.OnDown)
            {
                shooter.TurnOnShield();
            }
            else if (touchType == TouchType.OnRelease)
            {
                shooter.TurnOffShield();
            }
        }

        else if (touchSide == TouchSide.Right)
        {
            if (touchType == TouchType.OnDown)
            {
                if (!shooter.shield.isOn)
                {
                    if (shooter.CanFire())
                    {
                        if (shooter.gun.isAutomatic)
                        {
                            shooter.StartAutoFiring();
                        }
                        else
                        {
                            shooter.Fire(true);
                        }
                    }
                    else if (shooter.CanReload())
                    {
                        shooter.StartReloading();
                    }
                }
            }
            else if (touchType == TouchType.OnRelease)
            {
                if (shooter.isAutoFiring)
                {
                    shooter.StopAutoFiring();
                }
                if (shooter.isReloading)
                {
                    shooter.StopReloading();
                }
            }
        }
    }