コード例 #1
0
        public void GeneratorStatic(MonsterType category, int idGenerator, int x, int y)
        {
            if (inhibeGeneratorID.ContainsKey(idGenerator))
            {
                return;
            }
            OneMonster monster = new OneMonster();

            monster.Category      = category;
            monster.ID            = idGenerator;
            monster.X             = x;
            monster.Y             = y;
            monster.AnimationStep = 0;
            monster.Pattern       = patternStatic[0];
            monster.PatternStep   = 0;
            monster.PatternDelay  = 0;
            if (monster.PatternDelay == 0)
            {
                monster.PatternNonStop = true;
            }
            monsters.Add(monster);
            System.Diagnostics.Debug.WriteLine(String.Format("Static Monster #{3}: {0} at {1}/{2}", category, x, y, monsters.Count));
            // on rend inactif ce générateur
            inhibeGeneratorID.Add(idGenerator, -1); // toppé pour ne pas être supprimé
        }
コード例 #2
0
        // *********************************************************************

        /// <summary>
        /// Générateur de monstres
        /// </summary>
        /// <param name="category">Category monster</param>
        /// <param name="idGenerator">Identifier generator.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        public void Generator(MonsterType category, int idGenerator, int x, int y)
        {
            if (inhibeGeneratorID.ContainsKey(idGenerator))
            {
                return;
            }
            // x% de chance de générer un monstre ... qui diminue en fonction des monstres en vie
            if (All.RND(1000) > (16 - monsters.Count))
            {
                return;
            }
            OneMonster monster = new OneMonster();

            monster.Category      = category;
            monster.ID            = idGenerator;
            monster.X             = x;
            monster.Y             = y;
            monster.AnimationStep = All.RND(4);
            switch (category)
            {
            case MonsterType.Bat_1:
                monster.Pattern = patternBat1[All.RND(patternBat1.Count)];
                break;

            case MonsterType.Bat_2:
                monster.Pattern = patternBat2[All.RND(patternBat2.Count)];
                break;

            case MonsterType.Ghost:
                monster.Pattern = patternGhost[All.RND(patternGhost.Count)];
                break;

            case MonsterType.Shark:
                monster.Pattern = patternShark[All.RND(patternShark.Count)];
                break;
            }
            //monster.UsePattern = true;
            monster.PatternStep  = 0;
            monster.PatternDelay = Convert.ToInt32(monster.Pattern[1] * SPRITE_WIDTH);
            if (monster.PatternDelay == 0)
            {
                monster.PatternNonStop = true;
            }
            monsters.Add(monster);
            System.Diagnostics.Debug.WriteLine(String.Format("Monster #{3}: {0} at {1}/{2}", category, x, y, monsters.Count));
            // on rend inactif ce générateur
            inhibeGeneratorID.Add(idGenerator, generatorInhibeDelay);
        }
コード例 #3
0
 private void MoveXY(OneMonster monster, int x, int y)
 {
     monster.X            += x;
     monster.Y            += y;
     monster.PatternDelay -= Math.Abs(x);
 }
コード例 #4
0
 private void MoveY(OneMonster monster, int step)
 {
     monster.Y            += step;
     monster.PatternDelay -= Math.Abs(step);
 }