Esempio n. 1
0
        internal static void Load()
        {
            BaseModel = new FactionModel();

            BaseModel.FactionTable = new Dictionary <string, Dictionary <string, FactionRelationStatus> >();

            //load predefined factions
            //difference between None and Neutral is that Monsters will attack Neutral
            //None is a true non-alignment, whereas Neutral is meant for non-hostile NPCs and such
            BaseModel.FactionTable.Add("None", new Dictionary <string, FactionRelationStatus>());
            BaseModel.FactionTable.Add("Player", new Dictionary <string, FactionRelationStatus>()
            {
                { "Monster", FactionRelationStatus.Hostile }
            });
            BaseModel.FactionTable.Add("Neutral", new Dictionary <string, FactionRelationStatus>());
            BaseModel.FactionTable.Add("Monster", new Dictionary <string, FactionRelationStatus>()
            {
                { "Neutral", FactionRelationStatus.Hostile },
                { "Player", FactionRelationStatus.Hostile }
            });

            //load factions from defs
            try
            {
                TextAsset ta = CoreUtils.LoadResource <TextAsset>("Data/RPGDefs/factions");
                LoadFactionDataFromAsset(ta);
            }
            catch (Exception e)
            {
                Debug.LogError("Failed to load faction defs!");
                Debug.LogError(e);
            }
        }
Esempio n. 2
0
        public static FactionModel CloneFactionModel(FactionModel original)
        {
            FactionModel newModel = new FactionModel();

            newModel.FactionTable = new Dictionary <string, Dictionary <string, FactionRelationStatus> >();

            //deep copy faction model
            foreach (var outerKvp in original.FactionTable)
            {
                Dictionary <string, FactionRelationStatus> outerValue = new Dictionary <string, FactionRelationStatus>();
                foreach (var innerKvp in outerKvp.Value)
                {
                    outerValue.Add(innerKvp.Key, innerKvp.Value);
                }
                newModel.FactionTable.Add(outerKvp.Key, outerValue);
            }

            return(newModel);
        }
Esempio n. 3
0
 static void ListFactions()
 {
     ConsoleModule.WriteLine(FactionModel.GetFactionsList());
 }
Esempio n. 4
0
 private void LoadFactionModels()
 {
     FactionModel.Load();
 }