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; }
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(); } }
public void Shoot() { if (!CanShoot) { return; } CurrentGun.Shoot(); CanShoot = false; DoFireRate(); _playerStatsController.AddBulletShot(); _bus.Fire(new WeaponShoot()); }
// Use this for initialization void Start() { weapon = FindObjectOfType <CurrentGun>(); ChangeText(); }