public void Unequip() { if (!prefabModule) { return; } if (equipMode == EquipMode.Model) { UnityEngine.Object.Destroy(equippedGameObj); if (prefabModule.equipRemoveHelmet) { inventory.SetHelmet(true); } } if (equipMode == EquipMode.Part || equipMode == EquipMode.Physic) { Logger.logInfo("Update config node of equipped part: {0}", availablePart.title); partNode.ClearData(); KIS_Shared.PartSnapshot(equippedPart).CopyTo(partNode); equippedPart.Die(); } evaTransform = null; equippedPart = null; equippedGameObj = null; equipped = false; PlaySound(prefabModule.moveSndPath); prefabModule.OnUnEquip(this); }
public void Unequip(ActorType actorType = ActorType.API) { if (!prefabModule) { return; } // This must be firts thing to happen to prevent other handlers to trigger. equipped = false; if (equipMode == EquipMode.Model) { UnityEngine.Object.Destroy(equippedGameObj); if (prefabModule.equipRemoveHelmet) { inventory.SetHelmet(true); } } if (equipMode == EquipMode.Part || equipMode == EquipMode.Physic) { Debug.LogFormat("Update config node of equipped part: {0}", availablePart.title); partNode.ClearData(); KIS_Shared.PartSnapshot(equippedPart).CopyTo(partNode); equippedPart.Die(); } evaTransform = null; equippedPart = null; equippedGameObj = null; if (actorType == ActorType.Player) { UISoundPlayer.instance.Play(prefabModule.moveSndPath); } prefabModule.OnUnEquip(this); }