public void Initialize(int resQ, int resL, factions fac, float orbS, float fue, float mas, float hea, bool rad, bool sol, bool shi) { researchQuantity = resQ; researchLevels = resL; GameManager.potentialScore[(int)satTypes.Research] += resL; base.Initialize(fac, orbS, fue, mas, hea, rad, sol, shi); }
/*// special satellites that give bonus points or stuff * public void LaunchSpecial(int satNo) { * switch (satNo) { * case 1: * // Tutorial Part 4 Research Satellite to Return to Earth * GameManager.activeSatellites[(int)satTypes.Research]++; * spawnPick = selectSpawn(factions.USA); * SatResearch satellite = Object.Instantiate(instance.researchPrefab[(int)factions.USA]).GetComponent<SatResearch>(); * satellite.gameObject.transform.position = launchPads[spawnPick].transform.position; * satellite.gameObject.transform.rotation = launchPads[spawnPick].transform.rotation; * satellite.Initialize(20, 3, factions.USA, 50, 25, 2, 10, false, false, false); * specialSat = satellite; * break; * default: * break; * } * }*/ // launch a sat with specific properties, and return it in case it needs even more specific stuff done to it. public SatResearch LaunchResearchSpecific(int resQ, int resA, factions fac, float orbS, float fue, float mas, float hea, bool rad, bool sol, bool shi) { GameManager.activeSatellites[(int)satTypes.Research]++; spawnPick = selectSpawn(fac); // Pick a spawnpoint (launchpad) // instantiate satellite, put it in the correct spot, then give it all its variables. SatResearch satellite = Object.Instantiate(instance.researchPrefab[(int)fac]).GetComponent <SatResearch>(); satellite.gameObject.transform.position = launchPads[spawnPick].transform.position; satellite.gameObject.transform.rotation = launchPads[spawnPick].transform.rotation; satellite.Initialize(resQ, resA, fac, orbS, fue, mas, hea, rad, sol, shi); return(satellite); }
public void Initialize(factions fac, float orbS, float fue, float mas, float hea, bool rad, bool sol, bool shi) { faction = fac; startingOrbit = orbS; fuel = fue; mass = mas; health = hea; radioTransmitter = rad; solarPowered = sol; heatShield = shi; orbitalDecay = Random.Range(70, 130) / 100f; // Set the orbital decay to something random so not all satellite orbits decay equally. }
// Check which factions is launching a sattelite, and pick an appropriate launchpad. public int selectSpawn(factions fac) { switch (fac) { case factions.USSR: spawnPickUSSR++; if (spawnPickUSSR >= 3) { spawnPickUSSR = 0; } return(spawnPickUSSR); case factions.USA: spawnPickUSA++; if (spawnPickUSA >= 9) { spawnPickUSA = 6; } return(spawnPickUSA); default: return(0); } }
public IEnumerator DelayedLaunchResearchSpecific(int t, int resQ, int resA, factions fac, float orbS, float fue, float mas, float hea, bool rad, bool sol, bool shi) { yield return(new WaitForSeconds(t)); LaunchResearchSpecific(resQ, resA, fac, orbS, fue, mas, hea, rad, sol, shi); }
// Use this for initialization void Start() { //Giocatore e nemico player = factions.BLUE; enemy = factions.RED; //Assegno il numero di province iniziale al giocatore e all'IA numPlayerProvinces = 16; numEnemyProvinces = 16; //Supporto playerSupport = GameObject.Find ("playerSupport").GetComponent<Support> (); enemySupport = GameObject.Find ("enemySupport").GetComponent<Support> (); //Array di provincie e gruppi unitòà provinces = FindObjectsOfType<Province> (); provinces = provinces.OrderBy (p => p.ID).ToArray (); strengthIndicators = Canvas.FindObjectsOfType<StrengthIndicator> (); strengthIndicators = strengthIndicators.OrderBy (i => i.ID).ToArray (); units = FindObjectsOfType<Unit> (); units = units.OrderBy (u => u.ID).ToArray (); //Settaggio indicatori di forza foreach (Unit u in units) { u.SetupIndicator (); } debugInfluenceMap = GameObject.FindGameObjectsWithTag("InfluenceDebug"); //Box di selezione unità alleata e target attacco selectBox = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/SelectBox")); targetBox = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/TargetBox")); //Indicatore turno corrente turnText = Canvas.FindObjectOfType<Text> (); //Capitali blu e rossa blueCapital = 1; redCapital = 30; //Creazione grafo della mappa mapGraph = new Graph (); foreach (Province province in provinces) { mapGraph.AddNode (new Node (province.ID)); } foreach (Province province in provinces){ foreach (Province n in province.getNeighbours()) { mapGraph.AddVertex(province.ID,n.ID,1); } } //Inizializzazione IA influenceMap = InfluenceMap.getInstance (); influenceMap.BuildGraph (); strategicPlanner = StrategicPlanner.getInstance(); turn = player; turnCounter = 0; //Inizia gioco if (turn == player) PlayerTurn (); else if (turn == enemy) EnemyTurn (); }
//Gestione turno del nemico void EnemyTurn() { turnCounter ++; //turnText.text = "Turn " + turnCounter; Debug.Log (turnCounter); ResultManager (); enemySupport.ManagePoints (); //Ripristino punti azione (e ripristino anche la forza delle unità dell'IA) foreach (Unit u in units) { if (u != null) { u.ActionPoints = 1; u.SupportPoints = 1; float reinforceStrength = 0; //ripristino = forza iniziale + 12 / distanza da fonte rifornimenti (capitale alleata)) if (u.Faction== factions.BLUE && factions.BLUE == enemy) { reinforceStrength = 12 / (mapGraph.Distance(u.Province.ID,blueCapital) + 1); u.Strength += reinforceStrength; } else if (u.Faction == factions.RED && factions.RED == enemy ) { reinforceStrength = 12 / (mapGraph.Distance(u.Province.ID,redCapital) + 1); u.Strength += reinforceStrength; } } } /*IA NEMICA*/ //influenceMap.Update (); strategicPlanner.ExecutePlan (); turn = player; PlayerTurn (); }