using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; namespace KairoEngine.CharacterSystem { public class FactionRelation { public string title; public bool isEnemy = true; public FactionRelation(string title, bool isEnemy) { this.title = title; this.isEnemy = isEnemy; } } [CreateAssetMenu(fileName = "Faction", menuName = "KairoEngine/Faction", order = 4)] public class Faction : SerializedScriptableObject { public string title; public bool defaultRelationIsEnemy = true; public List _relations = new List(); private List relations = new List(); public void Initialize() { relations = new List(); foreach (var relation in _relations) { FactionRelation newRelation = new FactionRelation(relation.title, relation.isEnemy); relations.Add(newRelation); } } public bool IsEnemy(string factionName) { if(factionName == title) return false; for (int i = 0; i < relations.Count; i++) { if(relations[i].title == factionName) return relations[i].isEnemy; } return defaultRelationIsEnemy; } } }