public int GetEnginePrice(Engine.engineType myType) { int level = playerStats.engineMng.GetEngine(myType).level; int price = level * shipEnginePrice; return(price); }
public Engine GetEngine(Engine.engineType type) { foreach (Engine engine in engines) { if (engine.engine == type) { return(engine); } } return(null); }
public void RmvPowerOnEngine(Engine.engineType engineType, int amount) { Engine powerEngine = GetEngine(Engine.engineType.power); Engine myEngine = GetEngine(engineType); if (myEngine == null || powerEngine == null) { Debug.Log("wrong engine type"); return; } if (amount > myEngine.currentPwr) { amount = myEngine.currentPwr; } myEngine.currentPwr -= amount; powerEngine.currentPwr += amount; }
public void ClickOnUpgrade(Engine.engineType _engineType) { if (engMng == null) { return; } Engine engineToImprove = engMng.GetEngine(_engineType); if (engineToImprove.level < 10) { int cost = GetEngineCost(_engineType); if (stats.gold >= cost) { stats.gold -= cost; engineToImprove.LevelUp(); } } }
public int GetOperateLevel(Engine.engineType _engineType) { if (_engineType == Engine.engineType.navigation) { return(navigationOpeLevel); } else if (_engineType == Engine.engineType.repair) { return(repairOpeLevel); } else if (_engineType == Engine.engineType.weapon) { return(weaponOpeLevel); } else if (_engineType == Engine.engineType.medic) { return(medicOpeLevel); } else { return(0); } }
public int GetEngineCost(Engine.engineType _engineType) { if (_engineType == Engine.engineType.power) { return(powerEngineCost * engMng.GetEngine(_engineType).level); } if (_engineType == Engine.engineType.navigation) { return(navEngineCost * engMng.GetEngine(_engineType).level); } if (_engineType == Engine.engineType.weapon) { return(weaponEngineCost * engMng.GetEngine(_engineType).level); } if (_engineType == Engine.engineType.repair) { return(repairEngineCost * engMng.GetEngine(_engineType).level); } if (_engineType == Engine.engineType.medic) { return(medicEngineCost * engMng.GetEngine(_engineType).level); } return(9999); }
/// <summary> /// /// </summary> /// <param name="engine">Navigation,Repair,Weapon</param> public void AddPowerOnEngine(Engine.engineType engineType, int amount) { Engine powerEngine = GetEngine(Engine.engineType.power); Engine myEngine = GetEngine(engineType); if (myEngine == null || powerEngine == null) { Debug.Log("wrong engine type"); return; } if (amount > powerEngine.currentPwr) { amount = powerEngine.currentPwr; } if (myEngine.currentPwr + amount > myEngine.maxPwr) { amount = myEngine.maxPwr - myEngine.currentPwr; } if (amount <= powerEngine.currentPwr && myEngine.currentPwr + amount <= myEngine.maxPwr) { powerEngine.currentPwr -= amount; myEngine.currentPwr += amount; } }
public Vector3 GetEnginePos(Engine.engineType engineType, bool isAlly) { if (isAlly) { foreach (ShipRoom room in shipMap) { if (room.engine.engine == engineType) { return(room.roomPosition); } } } else { foreach (ShipRoom room in enemyShipMap) { if (room.engine.engine == engineType) { return(room.roomPosition); } } } return(Vector3.zero); }
public void GainExp(Engine.engineType engineType) { if (engineType == Engine.engineType.weapon) { weaponCurrentExp += 10; if (weaponCurrentExp >= weaponMaxExp) { if (weaponOpeLevel >= 6) { weaponOpeLevel = 6; weaponCurrentExp = weaponMaxExp; } else { weaponOpeLevel += 1; weaponCurrentExp -= weaponMaxExp; weaponMaxExp += weaponMaxExp / weaponOpeLevel; } } } else if (engineType == Engine.engineType.navigation) { navigationCurrentExp += 10; if (navigationCurrentExp >= navigationMaxExp) { if (navigationOpeLevel >= 6) { navigationOpeLevel = 6; navigationCurrentExp = navigationMaxExp; } else { navigationOpeLevel += 1; navigationCurrentExp -= navigationMaxExp; navigationMaxExp += navigationMaxExp / navigationOpeLevel; } } } else if (engineType == Engine.engineType.repair) { repairCurrentExp += 10; if (repairCurrentExp >= repairMaxExp) { if (repairOpeLevel >= 6) { repairOpeLevel = 6; repairCurrentExp = repairMaxExp; } else { repairOpeLevel += 1; repairCurrentExp -= repairMaxExp; repairMaxExp += repairMaxExp / repairOpeLevel; } } } else if (engineType == Engine.engineType.medic) { medicCurrentExp += 10; if (medicCurrentExp >= medicMaxExp) { if (medicOpeLevel >= 6) { medicOpeLevel = 6; medicCurrentExp = medicMaxExp; } else { medicOpeLevel += 1; medicCurrentExp -= medicMaxExp; medicMaxExp += medicMaxExp / medicOpeLevel; } } } else if (engineType == Engine.engineType.repairModule) { repairModuleCurrentExp += 10; if (repairModuleCurrentExp >= repairModuleMaxExp) { if (repairModuleOpeLevel >= 6) { repairModuleOpeLevel = 6; repairModuleCurrentExp = repairModuleMaxExp; } else { repairModuleOpeLevel += 1; repairModuleCurrentExp -= repairModuleMaxExp; repairModuleMaxExp += repairModuleMaxExp / repairModuleOpeLevel; } } } }
public void PowerEngine(Engine.engineType _engineType, int _pwrAmount) { engineMng.AddPowerOnEngine(_engineType, _pwrAmount); }
public Engine GetEngine(Engine.engineType engineType) { return(engineMng.GetEngine(engineType)); }