示例#1
0
        public int FireWeapon()
        {
            if (ammo[ActiveWeaponMode] > 0)
            {
                ammo[ActiveWeaponMode] -= 1;

                if (!SoundManagerScript.GetSoundResource(sounds[ActiveWeaponMode]).isPlaying)
                {
                    SoundManagerScript.PlayLongSound(sounds[ActiveWeaponMode]);
                }

                if (ActiveWeaponMode == "standard")
                {
                    if (attackTime > attackDelta)
                    {
                        GameObject WeaponEmission;
                        WeaponEmission = Instantiate(Projectile, Muzzle.transform.position, Muzzle.transform.rotation) as GameObject;
                        WeaponEmission.GetComponent <Rigidbody>().velocity = WeaponEmission.transform.TransformDirection(Vector3.forward * projectileVelocity);
                        attackTime              = 0;
                        ammo[ActiveWeaponMode] -= 10;
                    }
                }

                else if (!WeaponEmission[ActiveWeaponMode].isPlaying)
                {
                    weaponIsFiring = true;
                    WeaponEmission[ActiveWeaponMode].Play(true);
                }
            }

            return(ammo[ActiveWeaponMode]);
        }
示例#2
0
        public void MutePlayHelpMenuStory()
        {
            Debug.LogFormat(" MutePlayHelpMenuStory {0}", SoundManagerScript.GetSoundResource("Story").isPlaying);

            if (SoundManagerScript.GetSoundResource("Story").isPlaying)
            {
                SoundManagerScript.StopSound("Story");
            }
            else
            {
                SoundManagerScript.PlayLongSound("Story");
            }
        }