public void AddBrowserObjects() { for (int i = 0; i < mEditObject.Objects.Count; i++) { CircleBrowserObjectTemplate objectTemplate = mEditObject.Objects[i]; GameObject newBrowserObjectGameObject = NGUITools.AddChild(RotationPivot, BrowserObjectPrefab.gameObject); GUICircularBrowserObject newBrowserObject = newBrowserObjectGameObject.GetComponent <GUICircularBrowserObject>(); newBrowserObject.ParentBrowser = this; newBrowserObject.StackNumberLabel.text = objectTemplate.CenterLabelText; newBrowserObject.InventoryItemName.text = objectTemplate.BottomLabelText; newBrowserObject.WeightLabel.text = objectTemplate.TopLabelText; if (!GenericWorldItem.IsNullOrEmpty(objectTemplate.DopplegangerProps)) { newBrowserObject.Doppleganger = WorldItems.GetDoppleganger( objectTemplate.DopplegangerProps, newBrowserObject.transform, newBrowserObject.Doppleganger, WIMode.Stacked, 1.0f); } if (!string.IsNullOrEmpty(objectTemplate.BackgroundSpriteName)) { newBrowserObject.Background.spriteName = objectTemplate.BackgroundSpriteName; } BrowserObjects.Add(newBrowserObject); } RefreshBrowserObjects(); }
public void OnTriggerEnter(Collider other) { if (!IsInEffect) { return; } bool intersection = true; if (RequireLineOfSight) { Debug.Log("Requires line of sight, checking now..."); //check if we can see it RaycastHit hitInfo; if (Physics.Raycast( tr.position, Vector3.Normalize(tr.position - other.transform.position), out hitInfo, Collider.radius * 1.25f, OcclusionLayerMask)) { //we hit one of our occlusion layers on our way to the object //so this doesn't count as a hit intersection = false; } } IItemOfInterest ioi = null; if (WorldItems.GetIOIFromCollider(other, out ioi)) { ItemsOfInterest.SafeEnqueue(ioi); } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { IStackOwner owner = null; if (worlditem.Group.HasOwner(out owner) && owner != Player.Local) { return; } if (!HasProps) { RefreshFoodStuffProps(); } if (HasProps && WorldItems.IsOwnedByPlayer(worlditem)) { if (Props.IsLiquid) { options.Add(new WIListOption("Drink")); } else { options.Add(new WIListOption("Eat")); } } }
//Accessors //Methods override public void Update(GameObject parentObject, ref WorldItems world) { CheckForCloseness(parentObject, ref world); BulletObject parentBullet = parentObject as BulletObject; UpdateHitBox(parentBullet); }
//Accessors //Methods override public void Update(GameObject parentObject, ref WorldItems world) { CheckForCloseness(parentObject, ref world); TankObject parentTank = parentObject as TankObject; UpdateHitBox(parentTank); }
public void OnLocationGroupLoaded() { Structures.AddMinorToload(State.GraveyardStructure, 0, worlditem); if (!State.CreatedHeadstones) { //create headstones the first time we load the location group //after that they'll just load and unload normally WorldItem headstoneWorldItem = null; State.CreatedHeadstones = true; for (int i = 0; i < State.HeadstoneSpawnPoints.Count; i++) { if (WorldItems.CloneRandomFromCategory(State.HeadstoneCategory, location.LocationGroup, State.HeadstoneSpawnPoints[i], out headstoneWorldItem)) { headstoneWorldItem.Initialize(); HeadstoneAvatar hsa = headstoneWorldItem.Get <HeadstoneAvatar>(); if (i < State.Headstones.Count) { hsa.State.HeadstoneName = State.Headstones[i]; } hsa.RefreshProps(); } } } }
public void OnTriggerEnter(Collider other) { if (other.isTrigger) { return; } bool sendAvatarAction = false; if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem) { if (mIoiCheck.HasAtLeastOne(ObstructionTypes)) { LastItemsEncountered.Add(mIoiCheck.worlditem); mCleanListNextFrame = true; sendAvatarAction = true; } //always send OnPlayerEncounter regardless of whether it's an obstruction //this is used by creatures and plants etc. mIoiCheck.worlditem.OnPlayerEncounter.SafeInvoke(); if (sendAvatarAction) { //only send the avatar action if we've encountered one of the obstruction types Player.Get.AvatarActions.ReceiveAction((AvatarAction.PathEncounterObstruction), WorldClock.AdjustedRealTime); } } }
protected void FillTrapWithGoodies(float skillRoll) { int numGoodies = Mathf.Max(1, Mathf.FloorToInt(skillRoll * Globals.TrappingNumWaterGoodiesPerSkillRoll)); StackItem goodie = null; WICategory category = null; WIStackError error = WIStackError.None; if (WorldItems.Get.Category(FillCategoryName, out category)) { for (int i = 0; i < numGoodies; i++) { if (WorldItems.RandomStackItemFromCategory(category, out goodie)) { Stacks.Push.Item(worlditem.StackContainer, goodie, ref error); } } } if (worlditem.StackContainer.IsFull) { Trigger(null); } else { PlayAnimation(AnimationTriggerClipName); } }
private void SaveWorldItems() { string saveIDstr = saveID.ToString(); string[,] delFields = new string[, ] { { "SaveIDs", saveIDstr } }; DbCommands.DeleteTupleInTable("SavedWorldItems", delFields); WorldItems worldItems = FindObjectOfType <WorldItems>(); worldItems.SetWorldItemsList(); List <string[]> worldItemsList = worldItems.WorldItemList; foreach (string[] worldItemData in worldItemsList) { DbCommands.InsertTupleToTable("SavedWorldItems", saveIDstr, worldItemData[0], worldItemData[1], worldItemData[2], worldItemData[3], sceneLoader.GetCurrentSceneName(), worldItemData[4], worldItemData[5]); } }
private void LoadWorldItems() { string saveIDstr = PlayerPrefsManager.GetSaveGame().ToString(); WorldItems worldItems = FindObjectOfType <WorldItems>(); worldItems.DestroyWorldItems(); List <string[]> newWorldItemsList = new List <string[]>(); //Debugging.PrintDbQryResults(DbQueries.GetSavedWorldItemsQry(saveIDstr, sceneLoader.GetCurrentSceneName()), saveIDstr, sceneLoader.GetCurrentSceneName()); DbCommands.GetDataStringsFromQry(DbQueries.GetSavedWorldItemsQry(saveIDstr, sceneLoader.GetCurrentSceneName()), out newWorldItemsList, saveIDstr, sceneLoader.GetCurrentSceneName()); foreach (string[] worldItemData in newWorldItemsList) { string prefabPath = worldItemData[5]; UnityEngine.Object worldItemPrefab = Resources.Load(prefabPath); GameObject worldItem = Instantiate(worldItemPrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject; string[] parentPath = worldItemData[3].Split('/'); Transform parentTransform = GameObject.Find(parentPath[1]).transform; for (int i = 2; i < parentPath.Length - 1; i++) { parentTransform = parentTransform.Find(parentPath[i]); } worldItem.transform.SetParent(parentTransform, false); worldItem.transform.position = new Vector3(float.Parse(worldItemData[0]), float.Parse(worldItemData[1]), float.Parse(worldItemData[2])); worldItem.name = worldItemData[4]; } }
public void AttachToBomb(Bomb newBomb) { bomb = newBomb; if (bomb != null) { AttachedToBomb = true; } if (AttachedToBomb) { FuseDoppleganger = WorldItems.GetDoppleganger(State.DopplegangerProps, worlditem.tr, FuseDoppleganger, WIMode.World); FuseDoppleganger.transform.localPosition = bomb.FuseOffset; //don't let our colliders turn off worlditem.ActiveState = WIActiveState.Active; worlditem.ActiveStateLocked = true; } if (!CanBeFlammable) { Flammable flammable = null; if (worlditem.Is <Flammable> (out flammable)) { flammable.Finish(); } } if (!string.IsNullOrEmpty(State.MissionName)) { Player.Get.AvatarActions.Subscribe(AvatarAction.MissionVariableChange, new ActionListener(MissionVariableChange)); } }
private void InsertWorldItemsNotInDbFromScene(string scene) { WorldItems worldItems = FindObjectOfType <WorldItems>(); foreach (string[] worldItemDetailsArray in worldItems.WorldItemList) { bool itemExists = DbCommands.IsRecordInTable("PremadeWorldItems", "StartingLocationX = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[0]) + " AND " + "StartingLocationY = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[1]) + " AND " + "StartingLocationZ = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[2]) + " AND " + "StartingParentPath = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[3]) + " AND " + "StartingSceneNames = " + DbCommands.GetParameterNameFromValue(scene), worldItemDetailsArray[0], worldItemDetailsArray[1], worldItemDetailsArray[2], worldItemDetailsArray[3], scene ); if (!itemExists) { DbCommands.InsertTupleToTable("PremadeWorldItems", worldItemDetailsArray[0], //x worldItemDetailsArray[1], //y worldItemDetailsArray[2], //z worldItemDetailsArray[3], //parent scene, worldItemDetailsArray[4]); //item name } } }
public void OnTriggerExit(Collider other) { if (other.isTrigger || !GameManager.Is(FGameState.InGame)) { return; } IItemOfInterest ioi = null; if (WorldItems.GetIOIFromCollider(other, out ioi)) { if (LastExitedItemOfInterest != ioi) { LastExitedItemOfInterest = ioi; if (ioi.IOIType == ItemOfInterestType.Player) { Debug.Log("Player exited water in 'WaterSubmergeObjects'"); Player.Get.AvatarActions.ReceiveAction(AvatarAction.MoveExitWater, WorldClock.AdjustedRealTime); } else if (ioi.IOIType == ItemOfInterestType.WorldItem && ioi.worlditem.Is(WILoadState.Initialized)) { ioi.worlditem.OnExitBodyOfWater.SafeInvoke(); } OnItemOfInterestExitWater.SafeInvoke(); if (LastSubmergedItemOfInterest == ioi) { LastSubmergedItemOfInterest = null; } } } }
public ItemDrop DropItem(ItemDrop item) { item.GameWorld = GameWorld; item.GameArea = this; WorldItems.Add(item); GameWorld.AddTrackedEntity(item); return(item); }
public override string DisplayNamer(int increment) { if (!string.IsNullOrEmpty(State.DisplayName)) { return(WorldItems.CleanWorldItemName(State.DisplayName)); } return(worlditem.Props.Name.DisplayName); }
static void CalculateWorldItemSizes( ) { if (!Manager.IsAwake <WorldItems> ( )) { Manager.WakeUp <WorldItems> ("Frontiers_WorldItems"); } WorldItems.CalculateSizes(); }
public void OnGainPlayerFocus() { //Debug.Log("Gained player focus in arrow"); string directionName = WorldMap.GetMapDirectionNameFromRotation(ArrowTransform); string pathName = WorldItems.CleanWorldItemName(Choice.ConnectingPath) + "(" + directionName + ")"; Frontiers.GUI.GUIHud.Get.ShowAction(this, UserActionType.ItemUse, pathName, ArrowTransform, GameManager.Get.GameCamera); OnGainFocus.SafeInvoke(); }
public bool DateShard() { if (Player.Local.Tool.IsEquipped) { ArtifactShard shard = null; if (Player.Local.Tool.worlditem.Is <ArtifactShard>(out shard)) { if (shard.DateShard()) { //once the shard is dated //swap it out with a new shard //use the generic world item as a base //set the state so the shard shape is the same GenericWorldItem newShard = null; switch (shard.State.Age) { case ArtifactAge.Modern: default: newShard = ModernShard; break; case ArtifactAge.Old: newShard = OldShard; break; case ArtifactAge.Antiquated: newShard = AntiquatedShard; break; case ArtifactAge.Ancient: newShard = AncientShard; break; case ArtifactAge.Prehistoric: newShard = PrehistoricShard; break; } //now turn it into a stack item //this will allow us to prevent it from randomizing itself StackItem newShardStackItem = newShard.ToStackItem(); ArtifactShardState shardState = null; newShardStackItem.State = shard.worlditem.State; newShardStackItem.StackName = shard.worlditem.StackName; if (newShardStackItem.GetStateData <ArtifactShardState>(out shardState)) { shardState.HasChosenFragment = true; } WorldItems.ReplaceWorldItem(shard.worlditem, newShardStackItem); FXManager.Get.SpawnFX(transform.position, FXOnDate); } } } return(false); }
public void OnCollide(Collider withObject, Vector3 hitPoint) { CollidedWith = withObject; worlditem.ActiveStateLocked = false; worlditem.ActiveState = WIActiveState.Active; worlditem.tr.position = hitPoint; IItemOfInterest ioi = null; BodyPart bodyPart = null; if (gStuckToHelper == null) { gStuckToHelper = new GameObject("StuckToHelper").transform; } if (WorldItems.GetIOIFromCollider(withObject, out ioi, out bodyPart)) { switch (ioi.IOIType) { case ItemOfInterestType.Player: break; case ItemOfInterestType.Scenery: default: StuckTo = withObject.transform; break; case ItemOfInterestType.WorldItem: ProjectileTarget projectileTarget = null; if (ioi.worlditem.Is <ProjectileTarget>(out projectileTarget)) { projectileTarget.OnHitByProjectile(this, hitPoint); } if (bodyPart != null) { StuckTo = bodyPart.tr; } else { StuckTo = ioi.worlditem.tr; } break; } } if (StuckTo != null) { gStuckToHelper.parent = StuckTo; gStuckToHelper.position = worlditem.tr.position; gStuckToHelper.rotation = worlditem.tr.rotation; mStuckToLocalPosition = gStuckToHelper.localPosition; mStuckToLocalRotation = gStuckToHelper.localRotation; enabled = true; } worlditem.SetMode(WIMode.Frozen); }
public void OnSetSelection() { NoSkillOverlay.enabled = false; if (Tabs.SelectedTab == "Catalogue") { Debug.Log("OnSetSelection in book browser and tab is Catalogue"); //just let the catalogue do its thing WorldItems.ReturnDoppleganger(BookOrderDoppleganger); PushEditObjectToNGUIObject(); } else { Debug.Log("OnSetSelection in book browser and tab is Order"); WorldItems.ReturnDoppleganger(BookDoppleganger); CurrentOrder = null; if (Books.Get.HasPlacedOrder(library.Name, out CurrentOrder)) { //update the order doppleganger and stuff BookOrderShadow.enabled = true; OrderStatusLabelBottom.enabled = true; DopplegangerProps.CopyFrom(CurrentOrder.BookObject); BookOrderDoppleganger = WorldItems.GetDoppleganger(DopplegangerProps, BookOrderDopplegangerParent, BookOrderDoppleganger, WIMode.Stacked); Vector3 doppleGangerPosition = BookOrderDoppleganger.transform.localPosition; doppleGangerPosition.z = 0f; BookOrderDoppleganger.transform.localPosition = doppleGangerPosition; OrderStatusProgressBarParent.gameObject.SetActive(true); if (Books.Get.DeliverBookOrder(LibraryName)) { ReceivedOrder = true; OrderStatusLabelTop.text = CurrentOrder.BookObject.DisplayName + " has been added to your log"; OrderStatusLabelBottom.text = "Delivered"; OrderStatusProgressBarGlow.alpha = 0f; //Colors.Alpha(Colors.Get.MessageSuccessColor, 0.35f); OrderStatusProgressBar.sliderValue = 1f; } else { OrderStatusLabelTop.text = CurrentOrder.BookObject.DisplayName + " has been ordered"; OrderStatusProgressBar.sliderValue = CurrentOrder.NormalizedTimeUntilDelivery; OrderStatusProgressBarGlow.enabled = true; OrderStatusLabelBottom.text = "In Transit:"; } } else { //get rid of the doppleganger, hide everything WorldItems.ReturnDoppleganger(BookOrderDoppleganger); OrderStatusProgressBarParent.SetActive(false); OrderStatusLabelBottom.enabled = false; OrderStatusLabelTop.enabled = true; BookOrderShadow.enabled = false; OrderStatusLabelTop.text = "You have no outstanding orders"; } } }
public virtual void UpdateDoppleganger() { if (enabled && ShowDoppleganger) { Doppleganger = WorldItems.GetDoppleganger(DopplegangerProps, transform, Doppleganger, DopplegangerMode, Dimensions.x / 100f); } else { GameObject.Destroy(Doppleganger); } }
public void OnDepleted() { GenericWorldItem swap = null; WICategory category = null; if (WorldItems.Get.Category(State.CategoryName, out category) && category.GetItem(worlditem.GetHashCode(), out swap)) { WorldItems.ReplaceWorldItem(worlditem, swap); Finish(); } }
protected IEnumerator LaunchProjectile(Equippable equippable, Weapon weapon) { if (!HasProjectile) { //if we don't have a projectile it doesn't matter //MasterAudio.PlaySound (mEquippable.Sounds.SoundType, ToolDoppleganger.transform, mEquippable.Sounds.SoundUseUnuccessfully); mEquippable.UseUnsuccessfully(); ToolState = PlayerToolState.Equipped; yield break; } //convert the projectile object to a world item if it isn't already Projectile projectile = null; if (ProjectileObject.IsWorldItem) { //get the projectile from the existing worlditem projectile = ProjectileObject.worlditem.Get <Projectile>(); } else { WorldItem worlditemProjectile = null; //clone the projectile from the stack item WorldItems.CloneFromStackItem(ProjectileObject.GetStackItem(WIMode.Stacked), WIGroups.Get.Player, out worlditemProjectile); //initialize immediately worlditemProjectile.Initialize(); worlditemProjectile.transform.position = ToolActionPointObject.position; worlditemProjectile.transform.rotation = ToolActionPointObject.rotation; //set the projectile object to null ProjectileObject = null; //give it a second to initialze projectile = worlditemProjectile.Get <Projectile>(); } if (projectile != null) { projectile.Launch(ToolActionPointObject, weapon, LaunchForce); //play the launching sound mEquippable.UseSuccessfully(); //MasterAudio.PlaySound (mEquippable.Sounds.SoundType, ToolDoppleganger.transform, mEquippable.Sounds.SoundUseSuccessfully); yield return(null); } else { Debug.Log("Projectile was null"); } RefreshToolDoppleganger(false); yield return(null); if (UsesTensionMorph) { TensionChannel.Percent = 0f; } yield break; }
public void OnTriggerEnter(Collider other) { IItemOfInterest target = null; if (!WorldItems.GetIOIFromCollider(other, out target)) { return; } switch (Mode) { case TrapMode.Set: //uh oh //what kind of object are we switch (target.IOIType) { case ItemOfInterestType.Player: //there's a chance it won't trigger Skill lightStepSkill = null; if (Skills.Get.LearnedSkill("LightStep", out lightStepSkill)) { //TODO this is kind of a kludge, it should be a player script modifier //a la motor or visibility //we may be able to make it not trigger at all if (lightStepSkill.State.MasteryLevel > UnityEngine.Random.value) { //don't trigger the trap, just alert the player //SKILL USE lightStepSkill.Use(true); //the skill use will announce what happens //we don't trigger it! return; } } if (TryToTrigger(target)) { Player.Local.Status.AddCondition("BrokenBone"); } break; case ItemOfInterestType.WorldItem: TryToTrigger(target); break; default: break; } break; default: break; } }
public void OnDrawGizmos() { Gizmos.color = Colors.Alpha(Color.blue, 0.1f); Gizmos.DrawSphere(transform.position, WorldItems.WISizeToFloat(State.MaxSize)); Gizmos.DrawWireSphere(transform.position, 0.1f); Gizmos.color = Color.green; Gizmos.DrawLine(transform.position, transform.position + transform.up); Gizmos.color = Color.blue; Gizmos.DrawLine(transform.position, transform.position + transform.forward); Gizmos.color = Colors.Alpha(Color.yellow, 0.5f); Gizmos.DrawCube(mBounds.center, mBounds.size); }
public void OnTriggerEnter(Collider other) { if (other.isTrigger) { return; //lights will be handled elsewhere } if (mIsDispersed | mDispersing) { return; } switch (other.gameObject.layer) { case Globals.LayerNumPlayer: if (Vector3.Distance(Player.Local.Position, Position) > Collider.radius) { Player.Local.Status.AddCondition("Darkrot"); MasterAudio.PlaySound(MasterAudio.SoundType.Darkrot, mTr, "DarkrotInfect"); FXManager.Get.SpawnFX(Position, "AcidShower"); DarkrotAmount = 0f; Disperse(Mathf.Infinity); } break; case Globals.LayerNumWorldItemActive: //maybe we're Luminte? mIoiCheck = null; if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem) { mluminiteCheck = null; mluminiteNodeCheck = null; if (mIoiCheck.worlditem.Is <Luminite> (out mluminiteCheck) && !mluminiteCheck.IsDark) { DarkrotAmount = mluminiteCheck.AbsorbDarkrot(DarkrotAmount); MasterAudio.PlaySound(MasterAudio.SoundType.Darkrot, mTr, "DarkrotAbsorb"); } else if (mIoiCheck.worlditem.Is <LuminiteNode> (out mluminiteNodeCheck) && !mluminiteNodeCheck.IsDark) { DarkrotAmount = mluminiteNodeCheck.AbsorbDarkrot(DarkrotAmount); MasterAudio.PlaySound(MasterAudio.SoundType.Darkrot, mTr, "DarkrotAbsorb"); } if (DarkrotAmount <= 0f) { Disperse(Mathf.Infinity); } } break; default: break; } }
public void HandleControllerCollision(Collider other) { if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem) { if (mIoiCheck.HasAtLeastOne(ObstructionTypes)) { LastItemsEncountered.Add(mIoiCheck.worlditem); } //always send OnPlayerCollide regardless of whether it's an obstruction //this is used by creatures and plants etc. mIoiCheck.worlditem.OnPlayerCollide.SafeInvoke(); } }
public void RefreshDoppleganger() { if (Visible && ShowDoppleganger) { Doppleganger = WorldItems.GetDoppleganger(DopplegangerProps, DopplegangerParent, Doppleganger, WIMode.Stacked); WorldItems.FitDopplegangerToBounds(DopplegangerParent, Doppleganger, DopplegangerBoundsCollider.bounds); } else { WorldItems.ReturnDoppleganger(Doppleganger); } DopplegangerParent.transform.localEulerAngles = Vector3.zero; }
public void OnAttackHit(DamagePackage damage) { //see if we have line of sight with the target //hostile will have set our target object etc. //ColoredDebug.Log ("ORB: On attack HIT", "Green"); IItemOfInterest innocentBystander = null; Vector3 staticHitPosition = Vector3.zero; Vector3 targetHitPosition = Vector3.zero; if (WorldItems.HasLineOfSight(LuminiteGemPivot.position, damage.Target, ref targetHitPosition, ref staticHitPosition, out innocentBystander)) { //don't alter the damage package, we saw the target damage.HasLineOfSight = true; #if UNITY_EDITOR //ColoredDebug.Log ("ORB: Had line of sight, and it was the thing we wanted", "Green"); mFireStart = LuminiteGemPivot.position; mFireEnd = targetHitPosition; mFireColor = Color.green; #endif } else if (innocentBystander != null) { #if UNITY_EDITOR //ColoredDebug.Log ("ORB: Had line of sight, and it wasn't the thing we wanted, hitting anyway: " + innocentBystander.gameObject.name, "Yellow"); mFireStart = LuminiteGemPivot.position; mFireEnd = targetHitPosition; mFireColor = Color.yellow; #endif //we didn't see the target, we saw something else - change the target damage.HasLineOfSight = true; damage.Target = innocentBystander; } else { #if UNITY_EDITOR //ColoredDebug.Log ("ORB: Didn't have line of sight", "Red"); mFireStart = LuminiteGemPivot.position; mFireEnd = targetHitPosition; mFireColor = Color.red; #endif //we didn't see the target and didn't hit anything else damage.HasLineOfSight = false; mPowerBeam.StaticEndPoint = staticHitPosition; mPowerBeam.TargetObject = null; } mPowerBeam.Fire(Mathf.Infinity); }
public void RefreshDoppleganger() { if (!DopplegangerProps.IsEmpty) { InventoryLight.enabled = true; TargetLightIntensity = 1f; Doppleganger = WorldItems.GetDoppleganger(DopplegangerProps, DopplegangerParent, Doppleganger, DopplegangerMode); } else { InventoryLight.enabled = false; WorldItems.ReturnDoppleganger(Doppleganger); } }