public void InjureGroundCombat(ILocation loc, GroundUnit gu, float dam) { string st = string.Format("{0}: <color=navy>{1}</color> is <color=red>injured</color> {2} while in command of <color=magenta>{3}</color> on <color=white>{4}</color>.", StrategicClock.GetDate(), GetNameString(true), HP + "HP - " + (int)dam, gu.UnitName, loc.GetLocationName()); ModHP((int)dam * -1); AddHistory(st); }
public string GetName(GroundUnit unit, Theme theme = null) { string name = "NoValidThemeSet"; List <Range> Ranges = new List <Range> (); if (theme == null) { float last = 0; Theme lastT = null; foreach (Theme t in EmpireThemes.Keys) { if (lastT == null) { last = 0; } Ranges.Add(new Range(last, last + EmpireThemes[t], t)); lastT = t; } float roll = rnd.NextFloat(0, last); foreach (Range r in Ranges) { if (r.InRange(roll)) { lastT = r.theme; } // name = ThemeManager.GetName (unit); } } else { } name = GroundUnitCounter + ". Mobile Infanterie"; return(name); }
public void StepDownCommander(GroundUnit s) { NavalRole = NavalCommanderRole.NONE; SetAssigned(false); // shipPosting = null; Location = s.Location; string st = string.Format("{0}: <color=navy>{1}</color> <color=orange>steps down</color> as the <color=cyan>Commander</color> of <color=grey>{2}</color?.", StrategicClock.GetDate(), GetNameString(), s.UnitName); AddHistory(st); }
public Transform CreateGroundUnit(GroundUnit groundUnit) { Debug.Log("Ground unit on node " + groundUnit.node); Transform unitTransform = (Transform)Instantiate(groundUnits[groundUnit.type]); unitTransform.parent = groundUnit.planet.hexPlanet.transform; unitTransform.localPosition = groundUnit.planet.hexPlanet.getNodePosition(groundUnit.node); unitTransform.localRotation = groundUnit.planet.hexPlanet.getNodeOrientation(groundUnit.node); unitTransform.GetComponent<GroundUnitBehavior>().Link(groundUnit); return unitTransform; }
public void AppointCommander(GroundUnit s) { if (Location != s) { MoveTo(s.Location); } NavalRole = NavalCommanderRole.CMD; SetAssigned(true); // shipPosting = null; Location = s.Location; string st = string.Format("{0}: <color=navy>{1}</color> is <color=green>appointed</color> the <color=cyan>Commander</color> of <color=grey>{2}</color>.", StrategicClock.GetDate(), GetNameString(), s.UnitName); AddHistory(st); }
static void CleanseReferences(GroundUnit G) { G.empire.GroundUnits.Remove(G); foreach (Battlefield B in Battlefield.AllBattlefields) { if (B.Attackers.Contains(G)) { B.Attackers.Remove(G); } if (B.Defenders.Contains(G)) { B.Defenders.Remove(G); } } }
public void EntersGroundCombat(ILocation loc, GroundUnit gu) { string st = string.Format("{0}: <color=navy>{1}</color> enters ground combat in command of <color=magenta>{2}</color> on <color=white>{3}</color>.", StrategicClock.GetDate(), GetNameString(true), gu.UnitName, loc.GetLocationName()); AddHistory(st); }
public void Link(GroundUnit groundUnit) { this.groundUnit = groundUnit; this.planet = groundUnit.planet.hexPlanet.transform; }