예제 #1
0
        public void havePreference()
        {
            if (preferences == null)
            {
                preferences = new List <acegiak_KissingPreference>();

                List <acegiak_KissingPreference> possible = new List <acegiak_KissingPreference>();

                if (GameObjectFactory.Factory == null || GameObjectFactory.Factory.BlueprintList == null)
                {
                    return;
                }
                foreach (GameObjectBlueprint blueprint in GameObjectFactory.Factory.BlueprintList)
                {
                    if (!blueprint.IsBaseBlueprint() && blueprint.DescendsFrom("KissingPreference"))
                    {
                        //IPart.AddPlayerMessage(blueprint.Name);
                        GameObject sample = GameObjectFactory.Factory.CreateSampleObject(blueprint.Name);
                        if (sample.HasTag("classname") && sample.GetTag("classname") != null && sample.GetTag("classname") != "")
                        {
                            acegiak_KissingPreference preference = Activator.CreateInstance(Type.GetType(sample.GetTag("classname")), ParentObject) as acegiak_KissingPreference;
                            possible.Add(preference);
                        }
                    }
                }
                int count = Stat.Rnd2.Next(5);
                for (int i = 0; i < count; i++)
                {
                    int w = Stat.Rnd2.Next(possible.Count());
                    preferences.Add(possible[w]);
                }
            }
        }
예제 #2
0
        public static void Read(SerializationReader Reader, acegiak_Kissable kissable)
        {
            string classname = Reader.ReadString();
            Type   type      = Type.GetType(classname);
            acegiak_KissingPreference preference = (acegiak_KissingPreference)Activator.CreateInstance(type, kissable.ParentObject);

            //preference.setRomancable(romancable);
            preference.Load(Reader);
            kissable.preferences.Add(preference);
        }