public void UpdateModuleStatus(ShipModule module, GameTypes.ModuleType type, bool connected) { switch (type) { case GameTypes.ModuleType.FuelPack: if (connected) { fuelPack = module.GetComponent <FuelPack>(); Debug.Log("Ship: Fuel pack connected"); } else { fuelPack = null; Debug.Log("Ship: Fuel pack disconnected"); } break; case GameTypes.ModuleType.Thrusters: if (connected) { thrusters = module.GetComponent <Thrusters>(); Debug.Log("Ship: Thrusters connected"); } else { thrusters = null; Debug.Log("Ship: Thrusters disconnected"); } break; case GameTypes.ModuleType.Boosters: if (connected) { boosters = module.GetComponent <Boosters>(); Debug.Log("Ship: Boosters connected"); } else { boosters = null; Debug.Log("Ship: Boosters disconnected"); } break; case GameTypes.ModuleType.QuantumDrive: if (connected) { quantumDrive = module.GetComponent <QuantumDrive>(); Debug.Log("Ship: Quantum Drive connected"); } else { quantumDrive = null; Debug.Log("Ship: Quantum Drive disconnected"); } break; } }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && other.GetComponentInChildren <ModuleSlot>().connectedModule) { FuelPack fuelPack = other.GetComponentInChildren <FuelPack>(); if (!fuelPack.IsFull()) { fuelPack.AddFuel(energyUnits); Pickup(); } } }
public void ProcessPrintSignal(Vector2Int index) { int prefabIndex; if (index.x < PartPrinterData.MODULE_TYPES) { prefabIndex = index.x * 3 + index.y; } else { prefabIndex = 9; } Debug.Log("PartPrinter: Print request for index " + index + " / " + prefabIndex); float printCost = PartPrinterData.instance.printCosts[prefabIndex]; if (printSurfaceClear) { if (printCost > 0f) { Player player = FindObjectOfType <Player>(); if (player.GetComponentInChildren <ModuleSlot>().connectedModule) { FuelPack fuelPack = player.GetComponentInChildren <FuelPack>(); if (fuelPack.GetFuel() >= printCost) { fuelPack.DrainFuel(printCost); StartCoroutine(PrintPart(PartPrinterData.instance.modulePrefabs[prefabIndex])); } else { Debug.LogWarning("PartPrinter: Not enough energy"); } } else { Debug.LogWarning("PartPrinter: Not wearing Fuel Pack"); } } else { StartCoroutine(PrintPart(PartPrinterData.instance.modulePrefabs[prefabIndex])); } } else { Debug.LogWarning("PartPrinter: Print surface obstructed"); } }
public void EnableFuelPackHUD(FuelPack fuelPack) { fuel.fillAmount = fuelPack.GetFuelPercentage(); shields.fillAmount = fuelPack.GetShieldPercentage(); damage.fillAmount = shields.fillAmount; for (int i = 0; i < fuelPack.GetChargedCells(); i++) { chargedCells[i].enabled = true; } for (int i = 0; i < fuelPack.GetAvailableCells(); i++) { availableCells[i].enabled = true; } fuelPackHUD.SetActive(true); }