コード例 #1
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            if (north != null && north.MapSymbol != '#')
            {
                GameObject template = prefabList["wall_one_side"];

                GameObject wall = AddObject(mapBlock.Location, template, ref MapObject, "_N");

                wall.transform.rotation = Direction.North.GetRotation();

                mapBlock.addGameObject(wall);
            }

            if (south != null && south.MapSymbol != '#')
            {
                GameObject template = prefabList["wall_one_side"];

                GameObject wall = AddObject(mapBlock.Location, template, ref MapObject, "_S");

                wall.transform.rotation = Direction.South.GetRotation();

                mapBlock.addGameObject(wall);
            }

            if (west != null && west.MapSymbol != '#')
            {
                GameObject template = prefabList["wall_one_side"];

                GameObject wall = AddObject(mapBlock.Location, template, ref MapObject, "_W");

                wall.transform.rotation = Direction.West.GetRotation();

                mapBlock.addGameObject(wall);
            }

            if (east != null && east.MapSymbol != '#')
            {
                GameObject template = prefabList["wall_one_side"];

                GameObject wall = AddObject(mapBlock.Location, template, ref MapObject, "_E");

                wall.transform.rotation = Direction.East.GetRotation();

                mapBlock.addGameObject(wall);
            }
        }
コード例 #2
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            GameObject template = prefabList["teleport"];

            GameObject teleport = AddObject(mapBlock.Location, template, ref MapObject);

            var teleportConfig = mapBlock.getObjectConfigForType("teleport");

            if (teleportConfig != null)
            {
                if (teleportConfig.Teleport != null)
                {
                    if (teleportConfig.Teleport.Target != null && teleportConfig.Teleport.Target.Length == 2)
                    {
                        var teleportController = teleport.GetComponent <TeleportController>();
                        teleportController.TargetColumn = teleportConfig.Teleport.Target[0] - 1;
                        teleportController.TargetRow    = teleportConfig.Teleport.Target[1] - 1;
                    }

                    if (teleportConfig.Teleport.Rotation != null && teleportConfig.Teleport.Rotation.Length == 1)
                    {
                        var teleportController = teleport.GetComponent <TeleportController>();
                        teleportController.RotationDirection = teleportConfig.Teleport.Rotation[0];
                    }
                }
            }

            mapBlock.addGameObject(teleport);
        }
コード例 #3
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            GameObject template = prefabList["torch"];

            GameObject torch = AddObject(mapBlock.Location, template, ref MapObject);

            var torchConfig = mapBlock.getObjectConfigForType("torch");

            if (torchConfig != null && torchConfig.Rotation != null && torchConfig.Rotation.Length == 1)
            {
                var direction = (Direction)"NESW".IndexOf(torchConfig.Rotation[0]);
                torch.transform.rotation = direction.GetRotation();
            }
            else
            {
                AttachToWall(ref torch);
            }

            AssignObjectConfigByType(torch, "torch", mapBlock);

            mapBlock.addGameObject(torch);
        }
コード例 #4
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            GameObject template = prefabList[GetModel(mapBlock)];

            GameObject ducat = AddObject(mapBlock.Location, template, ref MapObject);

            if (EnableRotation(mapBlock))
            {
                var ducatConfig = mapBlock.getObjectConfigForType("ducat");
                if (ducatConfig != null && ducatConfig.Rotation != null && ducatConfig.Rotation.Length == 1)
                {
                    var direction = (Direction)"NESW".IndexOf(ducatConfig.Rotation[0]);
                    ducat.transform.rotation = direction.GetRotation();
                }
                else
                {
                    AttachToWall(ref ducat);
                }
            }

            AssignObjectConfigByType(ducat, "ducat", mapBlock);

            mapBlock.addGameObject(ducat);
        }
コード例 #5
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            string prefab = selectDecoration(mapBlock);

            GameObject template = prefabList[prefab];

            GameObject decoration = AddObject(mapBlock.Location, template, ref MapObject);

            var decorationConfig = mapBlock.getObjectConfigForType("decoration");

            if (decorationConfig != null && decorationConfig.Rotation != null && decorationConfig.Rotation.Length == 1)
            {
                var direction = (Direction)"NESW".IndexOf(decorationConfig.Rotation[0]);
                decoration.transform.rotation = direction.GetRotation();
            }
            else
            {
                AttachToWall(ref decoration);
            }

            AssignObjectConfigByType(decoration, "decoration", mapBlock);

            mapBlock.addGameObject(decoration);
        }
コード例 #6
0
ファイル: Crate.cs プロジェクト: LSTME/unity-dungeon-starter
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            var crateTemplate = prefabList["crate_01"];

            GameObject crate = AddObject(mapBlock.Location, crateTemplate, ref MapObject);

            mapBlock.addGameObject(crate);
        }
コード例 #7
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            GameObject template = prefabList["gate"];

            GameObject gate = AddObject(mapBlock.Location, template, ref MapObject);

            AssignObjectConfigByType(gate, "door", mapBlock);

            mapBlock.addGameObject(gate);
        }
コード例 #8
0
        private GameObject GenerateFloorObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, GameObject MapObject)
        {
            if (!GenerateFloor)
            {
                return(MapObject);
            }

            GameObject templateFloor = prefabList["floor_03"];

            GameObject floor = AddObject(mapBlock.Location, templateFloor, ref MapObject);

            mapBlock.addGameObject(floor);

            return(MapObject);
        }
コード例 #9
0
        private GameObject GenerateCeilingObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, GameObject MapObject)
        {
            if (!GenerateCeiling)
            {
                return(MapObject);
            }

            GameObject templateCeiling = prefabList["ceiling_03"];

            GameObject ceiling = AddObject(mapBlock.Location, templateCeiling, ref MapObject);

            mapBlock.addGameObject(ceiling);

            return(MapObject);
        }
コード例 #10
0
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            GenerateFloor = false;

            base.createGameObject(mapBlock, prefabList, ref MapObject);

            GameObject templateFloorButton = prefabList["floor_button"];

            GameObject floorButton = AddObject(mapBlock.Location, templateFloorButton, ref MapObject);

            AssignObjectConfigByType(floorButton, "floor_button", mapBlock);

            mapBlock.addGameObject(floorButton);
        }