コード例 #1
0
        public static void FinalizeEnv(EnvironmentObject env)
        {
            // Add gems to random locs
            for (int i = 0; i < 6; ++i)
            {
                CreateItem(env, ItemID.Gem, GetRandomMaterial(MaterialCategory.Gem), env.GetRandomEnterableSurfaceLocation());
            }

            // Add rocks to random locs
            for (int i = 0; i < 6; ++i)
            {
                CreateItem(env, ItemID.Rock, GetRandomMaterial(MaterialCategory.Rock), env.GetRandomEnterableSurfaceLocation());
            }

            CreateWorkbenches(env);

            CreateStartItems(env);
            CreateDebugItems(env);

            {
                var gen = FoodGenerator.Create(env.World);
                gen.MoveToMustSucceed(env, env.GetSurfaceLocation(env.Width / 2 - 2, env.Height / 2 - 2));
            }

            AddMonsters(env);
        }
コード例 #2
0
        static void AddMonsters(EnvironmentObject env)
        {
            var world = env.World;

            for (int i = 0; i < NUM_ORCS; ++i)
            {
                var livingBuilder = new LivingObjectBuilder(LivingID.Orc)
                {
                    Color = GetRandomColor(),
                };

                var living = livingBuilder.Create(world);
                living.SetAI(new Dwarrowdelf.AI.MonsterAI(living, world.PlayerID));

                Helpers.AddGem(living);
                Helpers.AddBattleGear(living);

                living.MoveToMustSucceed(env, env.GetRandomEnterableSurfaceLocation());
            }
        }