void Update() { if (fBulletsFired > fOverHeatRate) { fBulletsFired = fOverHeatRate; } if (Input.GetKey(KeyCode.F) && weaponManager.go_CurrentWeapon.name == this.name && blackBoard.fPlayerHealth > 0 && fBulletsFired > 0 && bCanShoot == true) { fBulletsFired--; StartCoroutine("FireRate"); ShootSound.Play(); fLastShot = Time.time; } else if (!Input.GetKey(KeyCode.F) && fBulletsFired <= fOverHeatRate && bRecharging == false) { Debug.Log("Recharging"); StartCoroutine("Recharge"); } else if (fBulletsFired <= 0) { StartCoroutine("CoolDown"); } }
public override void Update(GameTime gameTime) { if (Helper.CurrentGameStatus == GameStatus.PLAYING) { PreviousPosition = PixelPosition; OrbLight.Position = new Vector2(CentrePos.X, CentrePos.Y) - Camera.CamPos; switch (projectileState) { case PROJECTILE_STATUS.Idle: this.Visible = false; OrbLight.Enabled = false; break; case PROJECTILE_STATUS.Firing: flyTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; this.Visible = true; this.gotDirection = false; this.PixelPosition += (Direction * Velocity); OrbLight.Enabled = true; OrbLight.Scale = defaultScale; FaceThis(gameTime); CollisionCheck(); // Play sounds if (!ShootSoundPlayed) { ShootSound.Play(); ShootSoundPlayed = true; } break; case PROJECTILE_STATUS.Exploding: this.Visible = false; ShootSoundPlayed = false; OrbLight.Scale = defaultScale * 2; timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer > explosionLifeSpan - explosionLifeSpan + 0.1f) { OrbLight.Enabled = false; } if (timer > explosionLifeSpan) { timer = 0f; // Reload Projectile projectileState = PROJECTILE_STATUS.Idle; } break; } base.Update(gameTime); } }
public override void OnEvent(ShootSound evnt) { if (evnt.Shooter != entity) { Debug.Log("Shooter :" + evnt.Shooter); evnt.Shooter.GetComponent <WeaponManager>().WeaponAudioSource.clip = weaponManager.Weapons[evnt.WeaponID].GetComponent <Weapon>().ShootSound; evnt.Shooter.GetComponent <WeaponManager>().WeaponAudioSource.Play(); } }
private void Shoot() { m_animator.SetTrigger("Shoot"); GameObject pooledResource = m_miniGame.Resources.GetPooledResource(mg_jr_ResourceList.GAME_PREFAB_SNOWBALL); pooledResource.transform.position = m_snowballSpawnSocket.transform.position; pooledResource.transform.localRotation = m_snowballSpawnSocket.transform.localRotation; pooledResource.transform.parent = base.transform.parent; MinigameManager.GetActive().PlaySFX(ShootSound.ClipName()); }
private void SendSoundEvent() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject player in players) { var EventSound = ShootSound.Create(player.GetComponent <BoltEntity>()); EventSound.WeaponID = weaponManager.CurrentWeaponNumber; EventSound.Shooter = entity; EventSound.Send(); } }
static public void PlayShootSound() { ShootSound.Play(); }