public void IncreaseDamage()
 {
     EnemyData.EnemyType typeEnum = this.TypeEnum;
     if (typeEnum == EnemyData.EnemyType.doubleUp)
     {
         this.damage *= 2;
     }
 }
 public void TimeManipulate()
 {
     EnemyData.EnemyType typeEnum = this.TypeEnum;
     if (typeEnum == EnemyData.EnemyType.doubleUp)
     {
         this.damage /= 8;
     }
 }
 public Enemy(string name, string desc, CDouble hp, CDouble dam, EnemyData.EnemyType type, List <EnemyData.SpecialAttackChance> specialAttacks)
 {
     this.Name           = name;
     this.Description    = desc;
     this.HPMax          = hp;
     this.HP             = hp;
     this.damage         = dam;
     this.TypeEnum       = type;
     this.SpecialAttacks = specialAttacks;
 }
Example #4
0
        public EnemyData AddEnemy(EnemyData.EnemyType type, int offset_x, int offset_y)
        {
            EnemyData enemy_data = map_manager_.mapFactory.GetDefaultEnemyData(type).Clone() as EnemyData;

            MapVector current_offset = CurrentGroundOffset;

            enemy_data.spawnPosition = new MapVector(current_offset.x + offset_x, current_offset.y + offset_y);
            enemies_.Add(enemy_data);

            return(enemy_data);
        }
Example #5
0
        public EnemyModel Create(EnemyData.EnemyType type, Vector2 initialPos)
        {
            var enemyData  = new EnemyData(EnemyData.EnemyType.First);
            var enemyModel = new EnemyModel(enemyData, initialPos);

            var prefab      = Resources.Load <EnemyPresenter>("Enemy");
            var enemyObject = GameObject.Instantiate(prefab);

            enemyObject.Initialize(enemyModel);

            return(enemyModel);
        }
Example #6
0
        public EnemyData GetDefaultEnemyData(EnemyData.EnemyType enemy_type)
        {
            EnemyBundle enemy_bundle;

            if (enemies_map_.TryGetValue(enemy_type, out enemy_bundle))
            {
                return(enemy_bundle.enemyData);
            }
            else
            {
                throw new System.NotImplementedException("Not implemented enemy type: " + enemy_type);
            }
        }
Example #7
0
        public IEnumerator Generate()
        {
            map_data = builder_.InitMapData();

            builder_.Reset();

            int       num_ground = 10000;
            MapVector random_ground_width_range  = new MapVector(4, 20);
            MapVector random_ground_offset_range = new MapVector(2, 5);

            builder_.NewGround(
                0, 0, Mathf.Max(12, random_.Next(random_ground_width_range.x, random_ground_width_range.y)));

            // Try to add a test enemy
            builder_.AddEnemy(EnemyData.EnemyType.Dog, 10);

            bool last_is_high_ground = false;

            for (int i = 1; i < num_ground; i++)
            {
                bool this_is_high_ground  = random_.NextDouble() < 0.25 /* 25% possibility to be a high ground */;
                bool close_to_last_ground = last_is_high_ground != this_is_high_ground?random_.NextDouble() < 0.5 : false /* 50% possibility to be a closed ground */;

                var ground_data = builder_.NewGround(
                    close_to_last_ground ? 0 : random_.Next(random_ground_offset_range.x, random_ground_offset_range.y),
                    this_is_high_ground ? 1 : 0,
                    random_.Next(random_ground_width_range.x, random_ground_width_range.y / 2 * 2 /* round down */));

                if (random_.NextDouble() < 0.5)
                {
                    int enemy_type_index           = random_.Next(0, 5);
                    EnemyData.EnemyType enemy_type = EnemyData.EnemyType.Scout + enemy_type_index;
                    AddEnemy(EnemyData.EnemyType.Bomber, random_.Next(0, Mathf.Max(1, ground_data.region.width - 1)));
                }

                last_is_high_ground = this_is_high_ground;
            }

            map_data.blocks = builder_.BuildBlocks();
            yield return(map_data);
        }
Example #8
0
 public void AddEnemy(EnemyData.EnemyType enemy_type, int offset)
 {
     builder_.AddEnemy(enemy_type, offset);
 }
Example #9
0
 public EnemyData AddEnemy(EnemyData.EnemyType type, int offset)
 {
     return(AddEnemy(type, offset, 0));
 }