public void DeclareWarToFaction(Globals.FactionNames factionId) { EventManager.TriggerEvent <DiplomaticStatusData>(EventNames.DiplomaticStatusChange, new DiplomaticStatusData() { Source = Globals.PlayerFaction, Target = factionId, DiplomaticStatus = RelationStatus.War }); }
public void AskToJoinFederation(Globals.FactionNames factionId) { EventManager.TriggerEvent <DiplomaticStatusData>(EventNames.DiplomaticStatusChange, new DiplomaticStatusData() { Source = Globals.PlayerFaction, Target = factionId, DiplomaticStatus = RelationStatus.Federation }); }
public void Update(Globals.FactionNames factionId, int numberOfControlledCities, int numberOfSpies, int numberOfMilitary, int funds) { _factionDataDisplay.text = "Faction: " + factionId + "\nCities under control: " + numberOfControlledCities + "\nNumber of active spies: " + numberOfSpies + "\nNumber of active squads: " + numberOfMilitary + "\nFunds: " + funds; }
//public void DisplayAllFactionRelations() //{ // _factionRelationsText.text = "\tFaction Relations: \n"; // for (int foreignFactionIndex = 0; foreignFactionIndex < _factionRelations[(int)Globals.PlayerFaction].Length; foreignFactionIndex++) // { // if (_factionRelations[(int)Globals.PlayerFaction][foreignFactionIndex] != -1) // { // _factionRelationsText.text += ((Globals.FactionNames)foreignFactionIndex).ToString() + ": " + _factionRelations[(int)Globals.PlayerFaction][foreignFactionIndex] + "\n"; // } // } //} private void AttachFactionRelationsBreakdownToWindowsPromptText(Globals.FactionNames factionId) { List <FactionRelationElementData> relationElements = FactionRelations.GetFactionRelationElementData(factionId); for (int relationElementIndex = 0; relationElementIndex < relationElements.Count; relationElementIndex++) { _windowPromptText.text += relationElements[relationElementIndex].FactionRelationElementId.ToString() + ": " + relationElements[relationElementIndex].Value + "\n"; } }
public void DisplayFactionRelationsWithPlayer(Globals.FactionNames factionId) { int playerOnFaction = -1; int factionOnPlayer = -1; FactionRelations.GetRelationsWithPlayer(factionId, out playerOnFaction, out factionOnPlayer); _factionRelationsText.text = "\t" + factionId.ToString() + "\n\tFaction Relations: \n" + "Our views on them: " + playerOnFaction + "\nTheir views on us: " + factionOnPlayer + "\n Current status: " + FactionRelations.GetRelationStatusWithPlayer(factionId); }
public static RelationStatus GetRelationStatusWithPlayer(Globals.FactionNames factionId) { if (Globals.PlayerFaction != factionId) { return(_factionRelationStatuses[(int)Globals.PlayerFaction][(int)factionId]); } else { return(RelationStatus.Invalid); } }
public void SetFactionSupport(Globals.FactionNames faction, float newSupport) { float originalSupport = FactionsSupport[(int)faction]; FactionsSupport[(int)faction] = newSupport; float supportDifference = newSupport - originalSupport; if (supportDifference > 0) { if (FactionsSupport[(int)faction] > 1.0f) { FactionsSupport[(int)faction] = 1.0f; supportDifference = 1.0f - originalSupport; } float supportPerFaction = supportDifference / (_factionsSupport.Count - 1); float remainingSupport = 0.0f; for (int factionSupportIndex = 0; factionSupportIndex < FactionsSupport.Count; factionSupportIndex++) { if (factionSupportIndex != (int)faction) { FactionsSupport[factionSupportIndex] -= supportPerFaction; if (FactionsSupport[factionSupportIndex] < 0) { remainingSupport = -FactionsSupport[factionSupportIndex]; FactionsSupport[factionSupportIndex] = 0.0f; } } } if (remainingSupport > 0.0f) { float biggestSupport = float.MinValue; int biggestSupportIndex = -1; for (int factionIndex = 0; factionIndex < FactionsSupport.Count; factionIndex++) { if (FactionsSupport[factionIndex] < biggestSupport && factionIndex != (int)faction) { biggestSupportIndex = factionIndex; } } if (biggestSupportIndex != -1) { FactionsSupport[biggestSupportIndex] -= remainingSupport; remainingSupport = 0; } } } }
public static void GetRelationsWithPlayer(Globals.FactionNames factionId, out int playerViewOnFaction, out int factionViewOnPlayer) { if (Globals.PlayerFaction != factionId) { playerViewOnFaction = _factionRelations[(int)Globals.PlayerFaction][(int)factionId].GetRelationsTotal(); factionViewOnPlayer = _factionRelations[(int)factionId][(int)Globals.PlayerFaction].GetRelationsTotal(); } else { playerViewOnFaction = -1; factionViewOnPlayer = -1; } }
public List <SpyUnit> GetFactionSpies(Globals.FactionNames factionId) { List <SpyUnit> controlledSpies = new List <SpyUnit>(); for (int spyIndex = 0; spyIndex < PresentSpies.Count; spyIndex++) { if (PresentSpies[spyIndex].Faction == factionId) { controlledSpies.Add(PresentSpies[spyIndex]); } } return(controlledSpies); }
public List <SoldierUnit> GetFactionMilitary(Globals.FactionNames factionId) { List <SoldierUnit> controlledMilitary = new List <SoldierUnit>(); for (int soldierUnitIndex = 0; soldierUnitIndex < PresentSoldiers.Count; soldierUnitIndex++) { if (PresentSoldiers[soldierUnitIndex].Faction == factionId) { controlledMilitary.Add(PresentSoldiers[soldierUnitIndex]); } } return(controlledMilitary); }
public void RecruitSoldier(Globals.FactionNames factionId) { if (Stats.Control == (int)factionId) { SoldierUnit newSoldier = new SoldierUnit(this, factionId); PresentSoldiers.Add(newSoldier); Events.EventManager.TriggerEvent(EventNames.MilitaryRecruited, new UnitRecruitmentData() { NewlyRecruitedUnit = newSoldier }); } else { Debug.Log("The faction: " + factionId.ToString() + " doesn´t have enough support to recruit a spy unit in: " + Stats.PopulationNodeName); } }
public void RecruitSpy(Globals.FactionNames factionId) { if (Stats.GetFactionSupport(factionId) >= MINIMUM_SPY_RECRUITMENT_SUPPORT) { SpyUnit newSpy = new SpyUnit(this, factionId); PresentSpies.Add(newSpy); Events.EventManager.TriggerEvent(EventNames.SpyRecruited, new UnitRecruitmentData() { NewlyRecruitedUnit = newSpy }); } else { Debug.Log("The faction: " + factionId.ToString() + " doesn´t have enough support to recruit a spy unit in: " + Stats.PopulationNodeName); } }
public Faction(Globals.FactionNames factionId) { FactionId = factionId; }
public float GetFactionSupport(Globals.FactionNames faction) { return(FactionsSupport[(int)faction]); }
public static List <FactionRelationElementData> GetFactionRelationElementData(Globals.FactionNames factionId) { return(_factionRelations[(int)Globals.PlayerFaction][(int)factionId].RelationElements); }
public UnitBase(PopulationNode location, Globals.FactionNames factionNames) { CurrentLocation = location; Faction = factionNames; CreatedThisTurn = true; }
public SpyUnit(PopulationNode location, Globals.FactionNames factionId) : base(location, factionId) { }