public void OnPlayerUse() { Debug.Log("On player interact in timmorns brew"); if (worlditem.Is(WIMode.Equipped)) { Debug.Log("We're equipped"); //the only reason this will happen is if we're prompted by something //so insta-kill whatever we're looking at and distroy ourselves Damageable damageable = null; if (Player.Local.Surroundings.IsWorldItemInPlayerFocus && Player.Local.Surroundings.WorldItemFocus.worlditem.Is <Damageable> (out damageable)) { damageable.InstantKill(worlditem.DisplayName); worlditem.SetMode(WIMode.RemovedFromGame); } } }
public bool BurnFuel(float fuelBurned) { if (State.InfiniteUntilPickedUp && !mHasBeenAddedToInventory) { return(true); } State.FuelBurned += fuelBurned; if (FuelDoesDamage) { if (mCumulativeDamagePackage == null) { mCumulativeDamagePackage = new DamagePackage(); mCumulativeDamagePackage.Point = transform.position; mCumulativeDamagePackage.SenderMaterial = WIMaterialType.Fire; mCumulativeDamagePackage.SenderName = "Fire"; } mCumulativeDamagePackage.DamageSent += fuelBurned; if (mCumulativeDamagePackage.DamageSent > 1.0f) { mCumulativeDamagePackage.Target = worlditem; DamageManager.Get.SendDamage(mCumulativeDamagePackage); mCumulativeDamagePackage = null; } } if (State.IsDepleted) { OnDepleted.SafeInvoke(); if (!string.IsNullOrEmpty(DepletedState)) { worlditem.State = DepletedState; } if (DieOnDepleted) { Damageable damageable = null; if (worlditem.Is <Damageable>(out damageable)) { damageable.InstantKill("Fire"); } } return(false); } return(true); }
public void Update() { if (!mInitialized) { return; } State.StrengthLost += (float)(mMotile.CurrentMovementSpeed * State.StrengthLossPerMeterPerMinute * WorldClock.DeltaTimeMinutes); float normalizedStrength = State.NormalizedStrength; if (normalizedStrength <= 0.0f) { Damageable damageable = null; if (worlditem.Is <Damageable>(out damageable)) { damageable.InstantKill(WIMaterialType.None, "Exhaustion", false); } else { worlditem.SetMode(WIMode.Destroyed); Finish(); } } if (mFeebleElement != null) { mFeebleElement.ProgressValue = normalizedStrength; if (normalizedStrength < 0.5f) { mFeebleElement.Ping(0.5f); } else { mFeebleElement.StopPing(); } } }