Exemplo n.º 1
0
        public void Create()
        {
            _mapElements = new MapElement[_mapX, _mapY, _mapZ];

            UpdateAstar();

            AddWorldObject(new Tree(new Vector3Int(10, 10, _surfacePoint), 1));

            AddCreature(new Dwarf(new Vector3(40, 20, _surfacePoint), LivingType.Dwarf));
            AddCreature(new Dwarf(new Vector3(40, 21, _surfacePoint), LivingType.Dwarf));
            _creatures.Add(new Dwarf(new Vector3(40, 22, _surfacePoint), LivingType.Dwarf));

            AddCreature(new Pig(new Vector3(25, 40, _surfacePoint)));
            AddCreature(new Pig(new Vector3(26, 40, _surfacePoint)));

            AddCreature(new Cow(new Vector3(27, 40, _surfacePoint)));
            AddCreature(new Sheep(new Vector3(28, 40, _surfacePoint)));
            //_creatures.Add(new Dwarf(new Vector3(41, 20, _surfacePoint)));
            //_creatures.Add(new Dwarf(new Vector3(41, 21, _surfacePoint)));
            //_creatures.Add(new Dwarf(new Vector3(41, 22, _surfacePoint)));
            //_creatures.Add(new Dwarf(new Vector3(42, 20, _surfacePoint)));

            AddBuilding(new Depot(new Vector3Int(26, 40, _surfacePoint), 100));

            for (int x = 0; x < _mapX; x++)
            {
                for (int y = 0; y < _mapY; y++)
                {
                    for (int z = _surfacePoint; z < _mapZ; z++)
                    {

                        //if (z > _surfacePoint + 2)
                        //{
                        //    _mapElements[x, y, z] = new DirtCube(null, new Vector3Int(x,y,z));
                        //}
                        if (z == _surfacePoint + 1 || (z == _surfacePoint && x == 0 && y == 0))
                        {
                            _mapElements[x, y, z] = new GrassCube(new Vector3Int(x,y,z));
                        }
                        if (z == _surfacePoint + 2 && (y == 20 || y == 21 || y ==22) && x < 20)
                        {
                            _mapElements[x, y, z] = new DirtCube(new Vector3Int(x, y, z));
                        }
                        if (z == _surfacePoint + 2 && (y == 15 || y == 16) && x < 20)
                        {
                            _mapElements[x, y, z] = new WaterCube(new Vector3Int(x, y, z));
                        }
                        if (z == _surfacePoint && (
                            (x >= 0 && x < 25 && y > 25) ||
                            (x >= 75 && y > 25) ||
                            (y > 50) ||
                            (y == 26 && x > 27) ||
                            (y == 27 && x > 27)))
                        {
                            int random = DwarfRandom.GetRandomInt(0, 1);
                            if (random == 0)
                                _mapElements[x, y, z] = new RockCube(new Vector3Int(x, y, z));
                            if (random == 1)
                                _mapElements[x, y, z] = new IronOreCube(new Vector3Int(x, y, z));

                        }
                        if (z == _surfacePoint + 1 && (
                            (x >= 0 && x < 25 && y > 25) ||
                            (x >= 75 && y > 25) ||
                            (y > 50) ||
                            (y == 26 && x > 27) ||
                            (y == 27 && x > 27)))
                        {
                            _mapElements[x, y, z + 1] = new RockGroundCube(new Vector3Int(x, y, z));
                        }
                    }
                }
            }

            UpdateAllTiles();

            UpdateAstar();
        }
Exemplo n.º 2
0
        public void Create()
        {
            _mapElements = new MapElement[_mapX, _mapY, _mapZ];

            for (int x = 1; x < 25; x++)
            {
                for (int y = 1; y < 25; y++)
                {
                    _mapElements[x, y, 0] = new Tree(this, new Vector3Int(x,y,0));
                }
            }

            _creatures.Add(new Dwarf(this, new Vector3(40, 20, 0)));
            _creatures.Add(new Dwarf(this, new Vector3(40, 23, 0)));

            for (int x = 0; x < _mapX; x++)
            {
                for (int y = 0; y < _mapY; y++)
                {
                    for (int z = 0; z < _mapZ; z++)
                    {

                        if (z > 1)
                        {
                            _mapElements[x, y, z] = new DirtCube(null, this, new Vector3Int(x,y,z));
                        }
                        else if (z == 1 || (z == 0 && x == 0 && y == 0))
                        {
                            _mapElements[x, y, z] = new DirtCube(new GrassOverlay(), this, new Vector3Int(x,y,z));
                        }
                         if (x > 25 && y > 25)
                        {
                            _mapElements[x, y, z] = new RockCube(null, this, new Vector3Int(x,y,z));
                        }
                    }
                }
            }

            UpdateAstar();
        }