예제 #1
0
    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");
        }
    }
예제 #2
0
        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);
            }
        }
예제 #3
0
 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();
     }
 }
예제 #4
0
        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());
        }
예제 #5
0
 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();
     }
 }
예제 #6
0
 static public void PlayShootSound()
 {
     ShootSound.Play();
 }