Beispiel #1
0
 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._extraBurn)
         {
             num *= 1.2f;
         }
         if (this._fireParticleScale)
         {
             this._fireParticleScale.particleScale = num;
         }
         if (this._firelight)
         {
             this._firelight.intensity = num * 0.428571433f * ((!this._attacking) ? 1f : 0.8f);
         }
         if (this._fireAudioEmitter)
         {
             this._fireAudioEmitter.SetVolume(num);
         }
     }
     else
     {
         this._state = BurnableCloth.States.Burnt;
     }
 }
Beispiel #2
0
 private void OnDisable()
 {
     if (Scene.HudGui)
     {
         this._attacking = false;
         LocalPlayer.Inventory.Attacked.RemoveListener(new UnityAction(this.OnAttacking));
         LocalPlayer.Inventory.AttackEnded.RemoveListener(new UnityAction(this.OnAttackEnded));
         LighterControler.HasLightableItem = false;
         this.GotCleanDisable();
         if (this._state == BurnableCloth.States.Lighting)
         {
             this._state = BurnableCloth.States.Idle;
         }
         else if (this._state > BurnableCloth.States.Idle)
         {
             this.Burnt();
             this.Dissolved();
         }
         this._onDeactivated.Invoke();
     }
     if (this.Equals(LocalPlayer.ActiveBurnableItem))
     {
         LocalPlayer.ActiveBurnableItem = null;
     }
     if (ForestVR.Enabled)
     {
         LocalPlayer.vrPlayerControl.VRLightableTrigger.SetActive(false);
     }
 }
Beispiel #3
0
 private void Light()
 {
     if (this._fuel < Time.time)
     {
         GameStats.LitWeapon.Invoke();
         LocalPlayer.Inventory.DefaultLight.StashLighter();
         InventoryItemView component = this._inventoryMirror.transform.parent.GetComponent <InventoryItemView>();
         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._state != BurnableCloth.States.PutOutLighting) ? this._burnDuration : this._putOutFuel);
         if (component.ActiveBonus == WeaponStatUpgrade.Types.BurningWeaponExtra)
         {
             this._extraBurn = true;
             this._fuel     *= 3f;
         }
         else
         {
             this._extraBurn = false;
         }
         this._state = BurnableCloth.States.Burning;
         this._player.IsWeaponBurning = true;
         this._attacking       = false;
         component.ActiveBonus = (WeaponStatUpgrade.Types)(-1);
         FMODCommon.PlayOneshot("event:/fire/fire_built_start", transform);
     }
 }
Beispiel #4
0
 public void GotClean()
 {
     if (this._state == BurnableCloth.States.Burning)
     {
         this._putOutFuel = this._fuel;
         this.Burnt();
         this._state = BurnableCloth.States.PutOutIdle;
         this._player.IsWeaponBurning = false;
         FMODCommon.PlayOneshotNetworked("event:/player/actions/molotov_quench", base.transform, FMODCommon.NetworkRole.Any);
     }
 }
Beispiel #5
0
 private void Dissolving()
 {
     this._fuel -= Time.deltaTime;
     if (this._fuel > 0f)
     {
         this._clothDisolveMat.SetFloat("_BurnAmount", this._fuel / this._dissolveDuration);
     }
     else
     {
         this._state = BurnableCloth.States.Dissolved;
     }
 }
Beispiel #6
0
 private void GotCleanDisable()
 {
     if (this._state == BurnableCloth.States.Burning)
     {
         this._putOutFuel = this._fuel;
         this.Burnt();
         this._clothDisolveMat.SetFloat("_BurnAmount", 0f);
         this._state = BurnableCloth.States.PutOutIdle;
         this._player.IsWeaponBurning      = false;
         LighterControler.HasLightableItem = true;
         FMODCommon.PlayOneshotNetworked("event:/player/actions/molotov_quench", base.transform, FMODCommon.NetworkRole.Any);
     }
 }
Beispiel #7
0
 private void Burnt()
 {
     if (this._weaponFire)
     {
         UnityEngine.Object.Destroy(this._weaponFire);
         this._weaponFire = null;
     }
     base.GetComponent <Renderer>().sharedMaterial = this._clothDisolveMat;
     this._clothDisolveMat.SetFloat("_BurnAmount", 1f);
     this._fireParticleScale = null;
     this._firelight         = null;
     this._fuel  = this._dissolveDuration;
     this._state = BurnableCloth.States.Dissolving;
 }
Beispiel #8
0
 public void EnableBurnableCloth()
 {
     if (this._inventoryMirror)
     {
         this._inventoryMirror.SetActive(true);
     }
     if (this._craftMirror)
     {
         this._craftMirror.SetActive(true);
     }
     this._state = BurnableCloth.States.Idle;
     base.GetComponent <Renderer>().enabled = true;
     base.enabled = true;
 }
Beispiel #9
0
 private void Idle()
 {
     if (TheForest.Utils.Input.GetButtonAfterDelay("Lighter", 0.5f, false))
     {
         if (!LocalPlayer.Inventory.DefaultLight.IsReallyActive)
         {
             LocalPlayer.Inventory.LastLight = LocalPlayer.Inventory.DefaultLight;
             LocalPlayer.Inventory.TurnOnLastLight();
         }
         LocalPlayer.Inventory.SpecialItems.SendMessage("LightHeldFire");
         this._fuel  = Time.time + this._lightingDuration;
         this._state = ((this._state != BurnableCloth.States.PutOutIdle) ? BurnableCloth.States.Lighting : BurnableCloth.States.PutOutLighting);
         LighterControler.HasLightableItem = false;
     }
 }
Beispiel #10
0
 private void Dissolved()
 {
     if (this._inventoryMirror)
     {
         this._inventoryMirror.SetActive(false);
     }
     if (this._craftMirror)
     {
         this._craftMirror.SetActive(false);
     }
     base.GetComponent <Renderer>().enabled        = false;
     base.GetComponent <Renderer>().sharedMaterial = this._normalMat;
     this._clothDisolveMat.SetFloat("_BurnAmount", 1f);
     this._state = BurnableCloth.States.Disabled;
     this._player.IsWeaponBurning = false;
     base.enabled = false;
 }
Beispiel #11
0
 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 = ((this._state != BurnableCloth.States.PutOutIdle) ? BurnableCloth.States.Lighting : BurnableCloth.States.PutOutLighting);
             LighterControler.HasLightableItem = false;
         }
     }
 }