Esempio n. 1
0
        public void cycleGun(int direction)
        {
            int current = (int)currentGun;

            int Max = Enum.GetNames(typeof(CurrentGun)).Length - 1;

            if (direction > 0)
            {
                if (current == Max)
                {
                    current = 0;
                }
                else
                {
                    current++;
                }
            }

            if (direction < 0)
            {
                if (current == 0)
                {
                    current = Max;
                }
                else
                {
                    current--;
                }
            }

            currentGun = (CurrentGun)current;
        }
Esempio n. 2
0
 public void Shoot(Player player)
 {
     if (player != null)
     {
         var r     = (player.Location.X - Location.X) / (double)((player.Location - Location).Length);
         var angle = Math.Acos(r);
         CurrentGun.angle = angle;
         CurrentGun.Fire();
     }
 }
Esempio n. 3
0
        public void Shoot()
        {
            if (!CanShoot)
            {
                return;
            }

            CurrentGun.Shoot();
            CanShoot = false;

            DoFireRate();

            _playerStatsController.AddBulletShot();
            _bus.Fire(new WeaponShoot());
        }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     weapon = FindObjectOfType <CurrentGun>();
     ChangeText();
 }