public void Execute(Actions action) { OLD_TEventEntity objective; switch (action) { case Actions.Wait: default: return; case Actions.Heal: HealMyPlanets(); return; case Actions.Upgrade: LevelUpMyPlanets(); return; case Actions.AttackNeutral: //print("Hay neutrales"); if (ThereAreNeutralPlanets()) { objective = OLD_TEffector.GetNearestPlanet(myPlayer, map, true); Attack(objective, Random.value > 0.25f); } return; case Actions.AttackEnemy: objective = OLD_TEffector.GetNearestPlanet(myPlayer, map); Attack(objective, Random.value > 0.25f); return; } }
public Actions Decide() { bool attack = false; bool attackNeutal = false; if (PlanetsNeedHealing()) { return(Actions.Heal); } if (PlanetsNotAtMaximmumLevel() && Random.value > 0.5f) { return(Actions.Upgrade); } if (Random.value > 0.4f) { if (Random.value > 0.5f) { attack = true; } else { attackNeutal = true; } } OLD_TEventEntity objective; if (ThereAreNeutralPlanets() && !attack) { //print("Hay neutrales"); objective = OLD_TEffector.GetNearestPlanet(myPlayer, map, true); if (myPlayer.GetCurrentUnitsNumber() > OLD_TEffector.CountNecessaryUnitsToConquer(objective, myPlayer) * 1.5f || attackNeutal) { return(Actions.AttackNeutral); } } else { objective = OLD_TEffector.GetNearestPlanet(myPlayer, map); if (myPlayer.GetCurrentUnitsNumber() > OLD_TEffector.CountNecessaryUnitsToConquer(objective, myPlayer) * 1.5f || attack) { return(Actions.AttackEnemy); } } return(Actions.Wait); }