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);
        }
Beispiel #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[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);
        }
Beispiel #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);
        }
        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);
        }
        public override void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject)
        {
            mapBlock.Initialize();

            MapObject = GenerateFloorObject(mapBlock, prefabList, MapObject);

            MapObject = GenerateCeilingObject(mapBlock, prefabList, MapObject);
        }
Beispiel #6
0
        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);
        }
        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);
        }
Beispiel #8
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);
            }
        }
        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);
        }