Exemplo n.º 1
0
        public void ResetWorld(int _seed)
        {
            seed  = _seed;
            rng   = new Random(seed);
            input = new nullEngine.Managers.InputManager();

            player.active = false;

            for (var i = 1; i < enemy.Length; i++)
            {
                enemy[i].active = false;
            }

            ground    = new Tile[worldSize, worldSize];
            world     = new Tile[worldSize, worldSize];
            lastFrame = new Tile[screenX, screenY + 1];

            for (var i = 0; i < worldSize; i++)
            {
                for (var j = 0; j < worldSize; j++)
                {
                    ground[i, j] = new Tile();
                }
            }

            world = ground;

            for (var i = 0; i < screenX; i++)
            {
                for (var j = 0; j < screenY + 1; j++)
                {
                    lastFrame[i, j] = new Tile();
                }
            }

            worldOffsetX = 0;
            worldOffsetY = 0;

            var type = GenerationType.Rooms;

            if (seed % 3 == 0)
            {
                type = GenerationType.Caves;
            }

            onLoad(true, type);
        }
Exemplo n.º 2
0
        public Game(int seed, int Pstr, int Pdex, int Pcon, int Pintel, int Pwis, int Pcha, string playerName, bool random)
        {
            if (g == null)
            {
                g = this;
            }
            else
            {
                throw new Exception("Too many Game objects");
            }

            onUpdate = new List <Action>();

            this.seed = seed;

            if (random)
            {
                rng       = new Random();
                this.seed = rng.Next();
            }

            rng          = new Random(this.seed);
            startingSeed = "SEED: " + this.seed.ToString();

            input = new nullEngine.Managers.InputManager();

            enemyCount = 15;
            floor      = 1;

            worldSize = 80;
            screenX   = 119;
            screenY   = 28;

            gameX = 79;

            this.Pstr   = Pstr;
            this.Pdex   = Pdex;
            this.Pcon   = Pcon;
            this.Pintel = Pintel;
            this.Pwis   = Pwis;
            this.Pcha   = Pcha;
            PName       = playerName;

            ground    = new Tile[worldSize, worldSize];
            world     = new Tile[worldSize, worldSize];
            lastFrame = new Tile[screenX, screenY + 1];

            for (var i = 0; i < worldSize; i++)
            {
                for (var j = 0; j < worldSize; j++)
                {
                    ground[i, j] = new Tile();
                }
            }

            world = ground;

            for (var i = 0; i < screenX; i++)
            {
                for (var j = 0; j < screenY + 1; j++)
                {
                    lastFrame[i, j] = new Tile();
                }
            }

            worldOffsetX = 0;
            worldOffsetY = 0;

            drawBorders();
        }