private void Burning() { if (this._fuel >= 0f) { if (Scene.WeatherSystem.Raining) { this._fuel -= Time.deltaTime * ((!this._attacking) ? 5f : (this._fuelRatioAttacking + 5f)); } else { this._fuel -= Time.deltaTime * ((!this._attacking) ? 1f : this._fuelRatioAttacking); } float num = this.ExpoEaseIn(1f - this._fuel / this._burnDuration, 1f, 0f, 1f) * this._fireParticleSize * ((!this._attacking) ? 1f : 0.75f); if (this._fireParticleScale) { this._fireParticleScale.particleScale = num; } if (this._firelight) { this._firelight.intensity = num * 6f / 7f; } if (this._fireAudioEmitter) { this._fireAudioEmitter.SetVolume(num); } } else { this._state = BurnableItem.States.Burnt; } }
private void Light() { if (this._fuel < Time.time) { GameStats.LitWeapon.Invoke(); LocalPlayer.Inventory.DefaultLight.StashLighter(); Transform transform = (!this._weaponFireSpawn) ? base.transform : this._weaponFireSpawn.transform; this._weaponFire = (GameObject)UnityEngine.Object.Instantiate(this._weaponFirePrefab, transform.position, transform.rotation); this._weaponFire.transform.parent = transform; if (!this._weaponFire.activeSelf) { this._weaponFire.gameObject.SetActive(true); } this._fireParticleScale = this._weaponFire.GetComponentInChildren <ParticleScaler>(); this._firelight = this._weaponFire.GetComponentInChildren <Light>(); this._fireAudioEmitter = this._weaponFire.GetComponent <FMOD_StudioEventEmitter>(); base.GetComponent <Renderer>().sharedMaterial = this._burningMat; this._fuel = this._burnDuration; this._startTime = Time.time; this._state = BurnableItem.States.Burning; this._attacking = false; LocalPlayer.Inventory.IsWeaponBurning = true; FMODCommon.PlayOneshot("event:/fire/fire_built_start", transform); } }
private void Dissolving() { this._fuel -= Time.deltaTime; if (this._fuel > 0f) { this._disolveMat.SetFloat("_BurnAmount", this._fuel / this._dissolveDuration); } else { this._state = BurnableItem.States.Dissolved; } }
private void Dissolved(bool thrown) { this._state = BurnableItem.States.Idle; if (!thrown && LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, this._itemId)) { LocalPlayer.Inventory.UnequipItemAtSlot(Item.EquipmentSlot.RightHand, false, false, true); } base.GetComponent <Renderer>().sharedMaterial = this._normalMat; if (this._disolveMat) { this._disolveMat.SetFloat("_BurnAmount", 1f); } LocalPlayer.Inventory.IsWeaponBurning = false; }
private void Burnt() { if (this._weaponFire) { UnityEngine.Object.Destroy(this._weaponFire); this._weaponFire = null; } if (this._disolveMat) { base.GetComponent <Renderer>().sharedMaterial = this._disolveMat; this._disolveMat.SetFloat("_BurnAmount", 1f); this._fireParticleScale = null; this._firelight = null; this._fuel = this._dissolveDuration; this._state = BurnableItem.States.Dissolving; } else { this.Dissolved(false); } }
private void Idle() { if (LocalPlayer.Inventory.DefaultLight.IsReallyActive) { if (TheForest.Utils.Input.GetButton("Lighter")) { Scene.HudGui.SetDelayedIconController(this); } else { Scene.HudGui.UnsetDelayedIconController(this); } if (TheForest.Utils.Input.GetButtonAfterDelay("Lighter", 0.5f)) { Scene.HudGui.UnsetDelayedIconController(this); LocalPlayer.Inventory.SpecialItems.SendMessage("LightHeldFire"); this._fuel = Time.time + this._lightingDuration; this._state = BurnableItem.States.Lighting; LighterControler.HasLightableItem = false; } } }