public void Toggle(bool on, float intensity = -1) { if (intensity > -1) { PlayerLightData.Intensity = intensity; } if (LightEmission == null) { return; } if (on) { if (LightEmission.ContainsLight(PlayerLightData)) { LightEmission.UpdateLight(PlayerLightData); } else { LightEmission.AddLight(PlayerLightData); } } else { LightEmission.RemoveLight(PlayerLightData); } }
public void OnPickup() { InventorySlot Slot = InventoryManager.GetSlotFromItem(this.gameObject); if (Slot != null) { LightEmission = Slot.Owner.gameObject.GetComponent <LightEmissionPlayer>(); LightEmission.AddLight(PlayerLightData); } }
private void OnPickupServer(HandApply interaction) { InventorySlot Slot = InventoryManager.GetSlotFromItem(this.gameObject); if (Slot != null) { LightEmission = Slot.Owner.gameObject.GetComponent <LightEmissionPlayer>(); LightEmission.AddLight(PlayerLightData); } }
private void OnPickupServer(HandApply interaction) { var pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); InventorySlot Slot = InventoryManager.GetSlotFromItem(gameObject, pna); if (Slot != null) { LightEmission = Slot.Owner.GetComponent <LightEmissionPlayer>(); LightEmission.AddLight(PlayerLightData); } }
private void UpdateLights() { if (IsOn) { LightEmission.AddLight(PlayerLightData); LightToggleIntensity(); objectLightEmission.SetActive(true); } else { LightEmission.RemoveLight(PlayerLightData); objectLightEmission.SetActive(false); } }
public void OnAddToInventorySlot(InventorySlot slot) { if (isServer) { if (slot.IsUISlot) { if (!(CompatibleSlots.Contains(slot.equipSlot))) { LightEmission.RemoveLight(PlayerLightData); } else { if (LightEmission != null) { LightEmission.AddLight(PlayerLightData); } } } else { LightEmission.RemoveLight(PlayerLightData); } } }
public void OnInventoryMoveServer(InventoryMove info) { //was it transferred from a player's visible inventory? if (info.FromPlayer != null && LightEmission != null) { LightEmission.RemoveLight(PlayerLightData); LightEmission = null; } if (info.ToPlayer != null) { if (CompatibleSlots.Contains(info.ToSlot.NamedSlot.GetValueOrDefault(NamedSlot.none))) { LightEmission = info.ToPlayer.GetComponent <LightEmissionPlayer>(); LightEmission.AddLight(PlayerLightData); } } }
/// <summary> /// Allows you to toggle the light /// </summary> public void Toggle(bool on) { if (LightEmission == null) { Debug.LogError("LightEmission returned Null please check scripts"); return; } if (on && IsOn != true) { IsOn = true; LightEmission.AddLight(PlayerLightData); LightToggleIntensity(); objectLightEmission.SetActive(true); } else if (!on && IsOn) { IsOn = false; LightEmission.RemoveLight(PlayerLightData); objectLightEmission.SetActive(false); } }