using System.Collections; using System.Collections.Generic; using UnityEngine; using RPGCreationKit; using System.Linq; namespace RPGCreationKit { [CreateAssetMenu(fileName = "New Faction", menuName = "RPG Creation Kit/New Faction", order = 1)] [System.Serializable] public class Faction : ScriptableObject { public string ID = "FACTIONID"; public string factionName = "New Faction"; public bool friendlyFire = false; public List alliedFactions = new List(); public List hostileFactions = new List(); public static bool AreHostile(Faction f1, Faction f2) { if (f1.hostileFactions.Any(x => x.faction == f2) || f2.hostileFactions.Any(x => x.faction == f1)) { return true; } return false; } public static bool AreHostile(List f1, List f2) { bool factionsHostile = false; for (int x = 0; x < f1.Count; x++) { for (int z = 0; z < f2.Count; z++) { if (Faction.AreHostile(f1[x], f2[z])) { factionsHostile = true; break; } } if (factionsHostile) break; } return factionsHostile; } } [System.Serializable] public class FactionRelationship { public Faction faction; public int disposition; } }