public void RestartGameStats() { dialogManager.canvasManager = canvasManager; canvasManager.dialogManager = dialogManager; slotsController.gearsInLevel = gearsInLevel; slotsController.slots.Clear(); Slot slot1 = new Slot(gearSlot1, textSlot1, playerCam); slotsController.slots.Add(slot1); Slot slot2 = new Slot(gearSlot2, textSlot2, playerCam); slotsController.slots.Add(slot2); Slot slot3 = new Slot(gearSlot3, textSlot3, playerCam); slotsController.slots.Add(slot3); InitializeArsenals(); SpawnInitialGears(); ResetGearsInGame(); ResetGearSlots(slotsController); ResetArsenals(slotsController); if (!slotsController.activeSlot.slotEmpty && slotsController.activeWeapon != null) { slotsController.ApplyArsenalToGear(); } SpawnBosses(); SpawnShopKeeper(shopObject.transform.position); canvasManager.ToggleCanvas(CanvasType.LoadingCanvas); playerView.xRotation = 0f; }
public void ResetGearSlots(SlotsController slotsC) { foreach (Slot s in slotsC.slots) { if (s.slot.transform.childCount > 0) { GearController slotsGear = s.slot.transform.GetChild(0).GetComponent <GearController>(); if (slotsGear != null) { s.gear = slotsGear; s.slotEmpty = false; s.SetName(s.gear.name); s.gear.gameObject.SetActive(false); } else { Debug.Log("Child(0) of this slot is not a gear !"); s.slotEmpty = true; s.SetName("Empty Slot"); } } else { s.slotEmpty = true; s.SetName("Empty Slot"); } } slotsC.slotIndex = 0; slotsC.activeSlot = slotsC.slots[slotsC.slotIndex]; if (slotsC.activeSlot.slot.transform.childCount > 0 && !slotsC.activeSlot.slotEmpty) { slotsC.activeSlot.gear.gameObject.SetActive(true); slotsC.activeSlot.gear.enabled = true; if (slotsC.activeSlot.gear.gearType == GearType.Weapon) { slotsC.activeWeapon = slotsC.activeSlot.gear as Weapon; slotsC.activeConsumable = null; slotsC.ApplyArsenalToGear(); } else if (slotsC.activeSlot.gear.gearType == GearType.Consumable) { slotsC.activeConsumable = slotsC.activeSlot.gear as Consumable; slotsC.activeWeapon = null; } ActivateHudGear(slotsC.activeSlot.gear); } }