// Update is called once per frame void Update() { if (_animator.GetBool("isDead") || !CanMove) { return; } ProccesInput(); ChangeInputFromMultipleKeyPresses(); Move(); if (_lastShootTimer > ShootCooldown && Input.GetButton("P" + Player + "Fire")) { _gun.Shoot(Player); _audio.clip = ShootingAudioClips[Random.Range(0, ShootingAudioClips.Count)]; _audio.Play(); _lastShootTimer = 0; } _lastShootTimer += Time.deltaTime; }
/**** Combat controls ****/ public void OnModeSwitch() { pilotActionMap.Disable(); gunnerActionMap.Disable(); combatActionMap.Disable(); cabinActionMap.Enable(); if (mode == PlayerMode.GunnerMode) { Gunner.Shoot(false); Gunner.instance.player = null; } else if (mode == PlayerMode.PilotMode) { Pilot.instance.player = null; } mode = PlayerMode.CabinMode; //Debug.Log("Mode switched to Cabin"); ModeManager.ModeSwitch(this, PlayerMode.CabinMode); }
public void OnShoot(InputValue axis) { //Debug.Log("Shot: " + axis.Get()); Gunner.Shoot((float)axis.Get() > 0); }