Esempio n. 1
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);
        }
Esempio n. 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["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);
        }
Esempio n. 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[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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        protected string GetDucatType(MapBlock mapBlock)
        {
            var decorationConfig = mapBlock.getObjectConfigForType("ducat");

            var type = "";

            if (decorationConfig != null && decorationConfig.Model != null)
            {
                type = decorationConfig.Model;
            }

            return(type);
        }