bool ValidPlanetForTraining(ref AbstractPlanet planet) { if (planet.GetPlanetType() == AbstractPlanet.PlanetType.Hybrid || planet.GetPlanetType() == AbstractPlanet.PlanetType.Soldier) { return(true); } return(false); }
void ExpandAction(ref AbstractPlanet planet) { foreach (AbstractPlanet neigh in planet.adjacentPlanet) { if (actionHappened) { continue; } if (neigh.planetOwnership == AbstractPlanet.Ownership.Neutral && neigh.isContested == false) { if (planet.GetPlanetType() != AbstractPlanet.PlanetType.Hybrid && planet.GetPlanetType() != AbstractPlanet.PlanetType.Soldier && planet.enemySoldiers == 0) { planet.isRequestingSoldiers = true; } else { planet.isRequestingSoldiers = false; planet.planetRequesting = null; if (ValidPlanetForTraining(ref planet)) { planet.TrainSoldiers(true); } } ship = planet.CreateShip(AbstractPlanet.Ownership.Enemy); if (ship.soldiersOnBoard >= 1 || (!CanNewUnitsBeCreated() && ship.soldiersOnBoard > 0)) { LaunchShip(planet, neigh, planet.adjacentPaths, ship); planet.TrainSoldiers(false); } else if (!ship.GetIsLoading()) { ship.StartLoadingSoldiersToShip(planet); } action++; actionHappened = true; } } }
public void ActivateForPlanet(AbstractPlanet planet) { Deactivate(); selectedPlanet = planet.gameObject; activatedPanel = contextualMenuMap[planet.GetPlanetType()]; activatedPanel.SetActive(true); panelScripts = activatedPanel.GetComponents <AbstractPanel>(); foreach (AbstractPanel panelScript in panelScripts) { panelScript.ActivateForGameObject(selectedPlanet); } }
void UpgradeAction(ref AbstractPlanet planet) { if (planet.GetPlanetType() == AbstractPlanet.PlanetType.Reactor) { if (gameManager.enemyResources > 100 && CanNewUnitsBeCreated()) { if (!gameManager.GetUpgrading()) { gameManager.ActivateUpgrade(true, AbstractPlanet.Ownership.Enemy); action++; actionHappened = true; } } } }
void UpdateIconStatus() { if (planet.GetIsTrainingSoldiers()) { soldierIcon.gameObject.SetActive(true); } else { soldierIcon.gameObject.SetActive(false); } if (ManagerScript.Instance.GetUpgrading() && planet.GetPlanetType() == AbstractPlanet.PlanetType.Reactor) { upgradeIcon.gameObject.SetActive(true); } else { upgradeIcon.gameObject.SetActive(false); } }
string GetPlanetTypeName(AbstractPlanet planet) { switch (planet.GetPlanetType()) { case AbstractPlanet.PlanetType.Hybrid: return(PlanetNames.HYBRID_PLANET); case AbstractPlanet.PlanetType.Normal: return(PlanetNames.NORMAL_PLANET); case AbstractPlanet.PlanetType.Reactor: return(PlanetNames.REACTOR_PLANET); case AbstractPlanet.PlanetType.Resource: return(PlanetNames.RESOURCE_PLANET); case AbstractPlanet.PlanetType.Soldier: return(PlanetNames.SOLDIER_PLANET); } Debug.LogError("NormalContextMenu: PlanetType was not set on planet!"); return(null); }