Exemplo n.º 1
0
        public void Update()
        {
            foreach (Creature newParent in ParentList)
            {
                CreatureList.Add(new Creature(this, newParent));
            }
            ParentList.Clear();

            // 当たり判定用にどこにいるかを登録
            foreach (Creature creature in CreatureList.Where(x => x.Existence == true))
            {
                Land.AddCList(creature.Position, creature);
            }

            // Creatureの更新
            bool isTimeToUpdate = (++timer % timerMax) == 0;

            if (isTimeToUpdate)
            {
                foreach (Creature creature in CreatureList.Where(x => x.Existence == true))
                {
                    creature.Update();
                }
            }
            foreach (Creature creature in CreatureList.Where(x => x.Existence == true))
            {
                creature.Move();
            }
            hasTimerUpdated = false;

            // 消去フラグの立った生物は削除
            CreatureList.RemoveAll(x => x.Existence == false);

            TimeCount++;
        }
Exemplo n.º 2
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            using (var conn = new MySqlConnection(Settings.Default.ConnectionString))
            {
                conn.Open();
                using (var command = new MySqlCommand("select entry, name from creature_template", conn))
                {
                    var reader = command.ExecuteReader();
                    CreatureList.Clear();

                    while (reader.Read())
                    {
                        CreatureList.Add(new CreatureEntry {
                            Id   = reader.GetInt32(0),
                            Name = reader.GetString(1)
                        });
                    }

                    if (Id != 0)
                    {
                        var entry = CreatureList.FirstOrDefault(x => x.Id == Id);
                        list.SelectedItem = entry;
                        list.ScrollIntoView(entry);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void AddDemonForm()
        {
            Random          rand   = new Random();
            CreautureStates state  = new CreautureStates();
            string          sDemon = "Demon";

            foreach (var c in CreatureList)
            {
                if (c.Description == "Demon")
                {
                    ICreature demon = state.SPawnDemon(rand.Next(0, 9), rand.Next(0, 9));
                    CreatureList.Add(demon);
                }
                throw new ArgumentException("No demons");
            }
        }
Exemplo n.º 4
0
        public void Initialize(Land ptrLand, Drawer ptrDrawer)
        {
            Land = ptrLand;

            //ActクラスにCreateCreature用インターフェースポインタを登録
            Act.CreatureMgr = this;
            Act.Land        = Land;

            //仮 Creatureのグラフィックを読み込み
            Creature.LoadGraphic(ptrDrawer);


            //Creatureの登録
            for (int i = 0; i < Program.MaxCreature; i++)
            {
                CreatureList.Add(new Creature(this));
            }
        }
Exemplo n.º 5
0
 public void AddCreaturesToWorld(Entities entity, Weapon weapon, Armor armor,
                                 TypeOfAttack attackType, int positionX, int positionY, double hitPoints, string name)
 {
     CreatureList.Add(CreatureFactory.makeCreature(positionX, positionY, weapon, armor, attackType, hitPoints, name));
 }
Exemplo n.º 6
0
        public static CreatureList ParseCreatureList(string text)
        {
            // Remove redundant text
            text = text.Replace("unequip item.", "");
            text = text.Replace("equip new item.", "");

            List<string> creatures = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
            creatures.RemoveAll(s => s.Replace(" ", "").Length < 10); // Remove dummy lines

            CreatureList creatureList = new CreatureList();
            foreach (string creature in creatures)
            {
                try
                {
                    creatureList.Add(ParseCreature(creature));
                }
                catch
                {
                    // Ignore parsing errors
                }
            }

            return creatureList;
        }