public void ChangeCurrentRoom(GameObject room) { if (selectedRoom != null) { selectedRoom.GetComponent <RoomHighlight>().Unhighlight(); } selectedRoom = room; roomStats = room.GetComponent <RoomStats>(); overclockRoom = room.GetComponent <OverclockRoom>(); shipStats.roomBeingPlaced = selectedRoom; roomDetailsTab.SetInteractableState(true); if (FindObjectOfType <RoomPanelToggle>().GetIsOpen()) { room.GetComponent <RoomHighlight>().Highlight(); } else { room.GetComponent <RoomHighlight>().Unhighlight(); } UpdatePanelInfo(); if (!tutorialAlreadyPlayed) { Tutorial.Instance.SetCurrentTutorial(2, true); tutorialAlreadyPlayed = true; } }
public void StartMiniGame(MiniGameType miniGame, OverclockRoom room) { if (miniGame == MiniGameType.None) { return; // check for implemented mini-game } overclocking = true; activeRoom = room; AudioManager.instance.PlaySFX("Overclock"); additiveSceneManager.LoadSceneMerged(miniGame.ToString()); AnalyticsManager.OnMiniGameStarted(miniGame); }
public void EndMiniGame(MiniGameType miniGame, bool success, float statModification = 0) { int roomLevel = activeRoom.GetComponent <RoomStats>().GetRoomLevel() - 1; if (success) { float moraleModifier = MoraleManager.instance.GetMoraleModifier(); switch (miniGame) { case MiniGameType.Security: shipStats.Security += Mathf.RoundToInt(securityBaseAdjustments[roomLevel] * statModification * moraleModifier); SpawnStatChangeText(Mathf.RoundToInt(securityBaseAdjustments[roomLevel] * statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._Security).resourceIcon); EventSystem.instance.chanceOfEvent += securityPercentIncrease; break; case MiniGameType.Asteroids: shipStats.ShipWeapons += Mathf.RoundToInt(shipWeaponsBaseAdjustments[roomLevel] * statModification * moraleModifier); SpawnStatChangeText(Mathf.RoundToInt(shipWeaponsBaseAdjustments[roomLevel] * statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._ShipWeapons).resourceIcon); EventSystem.instance.chanceOfEvent += asteroidPercentIncrease; break; case MiniGameType.CropHarvest: shipStats.Food += Mathf.RoundToInt(foodBaseAdjustments[roomLevel] * statModification * moraleModifier); SpawnStatChangeText(Mathf.RoundToInt(foodBaseAdjustments[roomLevel] * statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._Food).resourceIcon); EventSystem.instance.chanceOfEvent += cropPercentIncrease; break; case MiniGameType.StabilizeEnergyLevels: shipStats.Energy += new Vector3(Mathf.RoundToInt(energyBaseAdjustments[roomLevel] * statModification * moraleModifier), 0, 0); SpawnStatChangeText(Mathf.RoundToInt(energyBaseAdjustments[roomLevel] * statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._Energy).resourceIcon); EventSystem.instance.chanceOfEvent += energyPercentIncrease; break; case MiniGameType.SlotMachine: shipStats.Credits += Mathf.RoundToInt(statModification * moraleModifier); // slots doesn't have a room level scaler? SpawnStatChangeText(Mathf.RoundToInt(statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._Credits).resourceIcon); EventSystem.instance.chanceOfEvent += slotPercentIncrease; break; case MiniGameType.HullRepair: shipStats.ShipHealthCurrent += new Vector2(Mathf.RoundToInt(hullRepairBaseAdjustments[roomLevel] * statModification * moraleModifier), 0); SpawnStatChangeText(Mathf.RoundToInt(hullRepairBaseAdjustments[roomLevel] * statModification * moraleModifier), GameManager.instance.GetResourceData((int)ResourceDataTypes._HullDurability).resourceIcon); EventSystem.instance.chanceOfEvent += hullRepairPercentIncrease; break; } } else { if (miniGame == MiniGameType.Asteroids) { shipStats.ShipHealthCurrent += new Vector2(Mathf.RoundToInt(failHullDurabilityBaseAdjustments[roomLevel] * statModification), 0); SpawnStatChangeText(Mathf.RoundToInt(failHullDurabilityBaseAdjustments[roomLevel] * statModification), GameManager.instance.GetResourceData((int)ResourceDataTypes._HullDurability).resourceIcon); } } if (success && activeRoom) { activeRoom.StartMinigameCooldown(); if (winSound == false) { AudioManager.instance.PlaySFX("De-Overclock"); winSound = true; } } activeRoom = null; //FindObjectOfType<CrewManagement>().crewManagementText.SetActive(true); AnalyticsManager.OnMiniGameFinished(miniGame, success, statModification); EndingStats.instance.AddToStat(1, EndingStatTypes.MinigamesPlayed); }