public override void StateChanged(State value) { if (!this.gameObject.activeInHierarchy) { return; } if (!this.gameObject.activeSelf) { return; } // If we are reloading hide the gun _ModelTransform.gameObject.SetActive(!(value is Reloading)); if (value is Firing) { // Tell the Weapon Fire View Component to start firing FPSWeaponFire.Fire(); } else { // Tell the Weapon Fire View Component to stop firing FPSWeaponFire.StopFiring(); } }
public override void StateChanged(State value) { if (!this.gameObject.activeInHierarchy) { return; } if (!this.gameObject.activeSelf) { return; } // If we are reloading hide the gun //_ModelTransform.gameObject.SetActive(!(value is Reloading)); if (value is Reloading) { if (FPSWeapon.CollectionMag > 0) { AudioSource.PlayClipAtPoint(ReloadSound, this.transform.position); for (int i = 0; i < oo.Magazine.Count; i++) { if (oo.Magazine[i].MagazineType.ToString() == FPSWeapon.WeaponType.ToString()) { //Debug.Log("dsadasdsadasdsadad"); FPSWeapon.Ammo = oo.Magazine[i].Amount; FPSWeapon.RoundSize = oo.Magazine[i].RoundSize; oo.CollectedMag--; FPSWeapon.CollectionMag--; oo.Magazine.Remove(oo.Magazine[i]); break; } } } //if(FPSplayer._MagazineList.Count > 0 && FPSplayer._BindMagazine) //{ // FPSWeapon.Ammo = FPSplayer._MagazineList[0]._Amount; //} //if(FPSWeapon.CollectionMag > 0 ) //{ // Debug.Log("dsadasdsadasdsadad"); // FPSWeapon.Ammo = FPSWeapon.RoundSize; // //FPSWeapon.Magazine[0].Amount; // FPSWeapon.CollectionMag--; //} Invoke("FinishedReload", FPSWeapon.ReloadTime); //FPSWeapon.Magazine.RemoveAt(0); } if (value is Firing) { //MuzzleFX.gameObject.SetActive(true); // Tell the Weapon Fire View Component to start firing FPSWeaponFire.Fire(); } else { //MuzzleFX.gameObject.SetActive(false); // Tell the Weapon Fire View Component to stop firing FPSWeaponFire.StopFiring(); } }