Beispiel #1
0
        protected virtual void WriteExitObjectToXML(XmlWriter writer, ExitObject obj)
        {
            writer.WriteStartElement("ExitObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            WriteObjectPositionToXML(writer, obj);

            writer.WriteElementString("YRotation", Helper.ToString(obj.YRotation));

            writer.WriteElementString("DestinationLevel", obj.LevelID.ToString());
            writer.WriteElementString("EntranceID", obj.EntranceID.ToString());

            writer.WriteStartElement("Parameters");

            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("count", "2");
            writer.WriteAttributeString("id", "0");
            writer.WriteString(obj.Param1.ToString());
            writer.WriteEndElement();
            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("id", "1");
            writer.WriteString(obj.Param2.ToString());
            writer.WriteEndElement();

            writer.WriteEndElement();

            writer.WriteEndElement();
        }
        private static void WriteExitObjectToXML(XmlWriter writer, ExitObject obj)
        {
            writer.WriteStartElement("ExitObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteElementString("DestinationLevel", obj.LevelID.ToString());
            writer.WriteElementString("EntranceID", obj.EntranceID.ToString());

            writer.WriteStartElement("Parameters");

            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("count", "2");
            writer.WriteAttributeString("id", "0");
            writer.WriteString(obj.Param1.ToString());
            writer.WriteEndElement();
            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("id", "1");
            writer.WriteString(obj.Param2.ToString());
            writer.WriteEndElement();

            writer.WriteEndElement();

            writer.WriteEndElement();
        }
Beispiel #3
0
        public ExitObject AddExitObject(int layer)
        {
            ExitObject obj = new ExitObject(
                InitialiseDataForObject(LevelObject.Type.EXIT), (int)GetNextUniqueID(), layer);

            m_LevelObjects.Add(obj.m_UniqueID, obj);
            return(obj);
        }
Beispiel #4
0
    private ExitObject AddExitObject(int roomId)
    {
        Room       room = dungeon.GetRoomById(roomId);
        GameObject go   = assetReference.GetGameObjectInstance("Exit");

        go.transform.SetParent(room.gameObject.transform);
        Vector3 pos = dungeon.GetCenterOfRoom(roomId);

        pos.y = playerScript.transform.localScale.y * 0.5f;
        go.transform.position = pos;
        ExitObject exitObj = go.GetComponent <ExitObject>();

        exitObj.color = Color.white;

        return(exitObj);
    }
 public void ReturnToMainMenu()
 {
     if (NewFileObject.activeInHierarchy)
     {
         NewFileObject.SetActive(false);
     }
     if (LoadFileObject.activeInHierarchy)
     {
         LoadFileObject.SetActive(false);
     }
     if (ExitObject.activeInHierarchy)
     {
         ExitObject.SetActive(false);
     }
     if (StringEnterObject.activeInHierarchy)
     {
         StringEnterObject.SetActive(false);
     }
 }
 public void ExitChosen()
 {
     ExitObject.SetActive(true);
 }
        private static void WriteExitObjectToXML(XmlWriter writer, ExitObject obj)
        {
            writer.WriteStartElement("ExitObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteElementString("DestinationLevel", obj.LevelID.ToString());
            writer.WriteElementString("EntranceID", obj.EntranceID.ToString());

            writer.WriteStartElement("Parameters");

            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("count", "2");
            writer.WriteAttributeString("id", "0");
            writer.WriteString(obj.Param1.ToString());
            writer.WriteEndElement();
            writer.WriteStartElement("Parameter");
            writer.WriteAttributeString("id", "1");
            writer.WriteString(obj.Param2.ToString());
            writer.WriteEndElement();

            writer.WriteEndElement();

            writer.WriteEndElement();
        }
Beispiel #8
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "key")
        {
            Key key = other.gameObject.GetComponentInParent <Key>();
            PlayerModel.GetInstance().AddKey(key);
            other.transform.parent.gameObject.SetActive(false);
            ObjectCache.instance.audioManager.PlaySound("key");
            Events.instance.Raise(new KeyCollected(key.keyInfo.keyColor, PlayerModel.GetInstance().keysCollected.Count));
            MessageManager.GetInstance().ShowMessage("Find the door for this key !!!");
            if (GameModel.Instance.didSeeKeyHint <= 3)
            {
                MessageManager.GetInstance().ShowMessage("Hint: Door color matches key color!!!", 1f);
            }
            GameModel.Instance.didSeeKeyHint++;
        }
        if (_charScript.canUpdate && other.gameObject.name == "exit")
        {
            if (other.gameObject.GetComponentInParent <ExitObject>().isLevelExit)
            {
                ObjectCache.instance.gameTimer.PauseTimer();
                _charScript.canUpdate = false;
                other.transform.parent.gameObject.SetActive(false);
                ObjectCache.instance.mainGame.PlayGameEndAnim(1);
            }
            else
            {
                ExitObject exitObj = other.gameObject.GetComponentInParent <ExitObject>();
                PlayerModel.GetInstance().AddExitObject(exitObj);
                other.transform.parent.gameObject.SetActive(false);
                ObjectCache.instance.audioManager.PlaySound("exitObject");
                Events.instance.Raise(new PieceCollected(exitObj.color, PlayerModel.GetInstance().exitDoorKey.Count));
                MessageManager.GetInstance().ShowMessage(string.Format("Pieces Found {0}/{1} !", PlayerModel.GetInstance().exitDoorKey.Count, ObjectCache.instance.dungeon.exitObjects.Count));
                if (ObjectCache.instance.dungeon.exitObjects.Count != PlayerModel.GetInstance().exitDoorKey.Count)
                {
                    MessageManager.GetInstance().ShowMessage("Find the remaining pieces !!!");
                }
                else
                {
                    MessageManager.GetInstance().ShowMessage("Find the exit !!!");
                }
            }
        }
        if (other.gameObject.name == "SpikeBase")
        {
            if (!ObjectCache.instance.player.isTimeShieldActive)
            {
                other.gameObject.GetComponentInParent <Spike>().Play();
            }
        }
        else if (!_isSpikeShieldActive && other.gameObject.name == "Spikes")
        {
            //if time shield is active dont hit player
            if (ObjectCache.instance.player.isTimeShieldActive)
            {
                return;
            }
            if (_hitCoroutine == null)
            {
                PlayerModel.GetInstance().UpdateAvailableItemCount(E_Item.Health, -1);
                OnHit();

                int count = 2;
                for (int index = 0; index < count; index++)
                {
                    GameObject go   = AssetReference.instance.GetGameObjectInstance("Splash");
                    Room       room = ObjectCache.instance.dungeon.GetRoomById(currentRoomId);
                    room.roomData.dungeonElements.decals.Add(go);
                    go.transform.SetParent(room.gameObject.transform);
                    Vector3 position = transform.position + (index * Random.Range(-5.0f, 5.0f)) * Vector3.right + (index * Random.Range(-5.0f, 5.0f)) * Vector3.forward;
                    yPos                 += 0.2f;
                    position.y            = yPos;
                    go.transform.position = position;
                }

                if (PlayerModel.GetInstance().GetAvailableItemCount(E_Item.Health) == 0)
                {
                    GameEnd();
                }
            }
        }
        if (other.gameObject.name == "ItemLife")
        {
            if (PlayerModel.GetInstance().GetMaxAvailableItemCount(E_Item.Health) == PlayerModel.GetInstance().GetAvailableItemCount(E_Item.Health))
            {
            }
            else
            {
                ObjectCache.instance.audioManager.PlaySound("health");
                PlayerModel.GetInstance().UpdateAvailableItemCount(E_Item.Health, 1);
                other.gameObject.SetActive(false);
            }
        }
        if (other.gameObject.name == "ItemDiamond")
        {
            ObjectCache.instance.audioManager.PlaySound("diamond");
            other.gameObject.SetActive(false);
            Events.instance.Raise(new UpdateDiamondEvent(1, true));
        }
    }
Beispiel #9
0
        private void ReadObjectTable(NitroOverlay ovl, uint offset, int area)
        {
            uint subtbl_num    = ovl.Read32(offset);
            uint subtbl_offset = ovl.ReadPointer(offset + 0x4);

            for (uint st = 0; st < subtbl_num; st++)
            {
                uint curoffset = subtbl_offset + (st * 8);

                byte flags          = ovl.Read8(curoffset);
                byte entries_num    = ovl.Read8(curoffset + 0x1);
                uint entries_offset = ovl.ReadPointer(curoffset + 0x4);

                byte type  = (byte)(flags & 0x1F);
                byte layer = (byte)(flags >> 5);

                if (type == 11)
                {
                    m_MinimapFileIDs = new ushort[entries_num];
                }

                for (byte e = 0; e < entries_num; ++e)
                {
                    LevelObject    obj;
                    INitroROMBlock objData = new INitroROMBlock();
                    objData.m_Data = ovl.ReadBlock((uint)(entries_offset + e * k_LevelObjTypeSizes[type]), (uint)k_LevelObjTypeSizes[type]);
                    switch (type)
                    {
                    case 0:
                        obj = new StandardObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 1:
                        obj = new EntranceObject(objData, m_LevelObjects.Count, layer, m_EntranceID++);
                        break;

                    case 2:     // Path Node
                        obj = new PathPointObject(objData, m_LevelObjects.Count, m_PathNodeID++);
                        break;

                    case 3:     // Path
                        obj = new PathObject(objData, m_LevelObjects.Count, (ushort)m_PathID++);
                        break;

                    case 4:
                        obj = new ViewObject(objData, m_LevelObjects.Count, m_ViewID++);
                        break;

                    case 5:
                        obj = new SimpleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 6:
                        obj = new TpSrcObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 7:
                        obj = new TpDstObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 8:
                        // Fog
                        obj = new FogObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 9:
                        obj = new DoorObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 10:
                        obj = new ExitObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 11:
                        obj = new MinimapTileIDObject(objData, m_LevelObjects.Count, layer, m_MinimapTileIDNum++);
                        // This is still used by Minimap Editor
                        m_MinimapFileIDs[e] = ovl.Read16((uint)(entries_offset + (e * 2)));
                        break;

                    case 12:
                        // per-area minimap scale factors
                        obj = new MinimapScaleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 14:
                        // ??? Unknown
                        obj = new Type14Object(objData, m_LevelObjects.Count, layer, area);
                        break;

                    default:
                        throw new InvalidDataException("Bad object type: " + type);
                    }

                    m_LevelObjects.Add(obj.m_UniqueID, obj);
                }
            }
        }
Beispiel #10
0
        protected virtual void ReadExitObject(XmlReader reader, Level level)
        {
            int layer = int.Parse(reader.GetAttribute("star"));

            ExitObject obj = level.AddExitObject(layer);

            while (reader.Read())
            {
                reader.MoveToContent();
                if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("Position"))
                {
                    Vector3 position = ReadPositionVector3(reader);
                    obj.Position = position;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("YRotation"))
                {
                    float yRotation = Helper.ParseFloat(reader.ReadElementContentAsString());
                    obj.YRotation = yRotation;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("DestinationLevel"))
                {
                    obj.LevelID = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("EntranceID"))
                {
                    obj.EntranceID = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("Parameters"))
                {
                    while (reader.Read())
                    {
                        reader.MoveToContent();
                        if (reader.NodeType.Equals(XmlNodeType.Element))
                        {
                            if (reader.LocalName.Equals("Parameter"))
                            {
                                int    paramID = int.Parse(reader.GetAttribute("id"));
                                ushort param   = ushort.Parse(reader.ReadElementContentAsString());

                                if (paramID == 0)
                                {
                                    obj.Param1 = param;
                                }
                                else if (paramID == 1)
                                {
                                    obj.Param2 = param;
                                }
                            }
                        }
                        else if (reader.NodeType.Equals(XmlNodeType.EndElement) && reader.LocalName.Equals("Parameters"))
                        {
                            break;
                        }
                    }
                }
                else if (reader.NodeType.Equals(XmlNodeType.EndElement) && reader.LocalName.Equals("ExitObject"))
                {
                    break;
                }
            }
        }
Beispiel #11
0
 public void AddExitObject(ExitObject obj)
 {
     _exitObjects.Add(obj);
 }
Beispiel #12
0
    public bool CreateLevel()
    {
        ItemConfig  config      = ConfigModel.Instance.GetItemConfigForLevel(GameModel.Instance.currLevel);
        LevelConfig levelConfig = ConfigModel.Instance.GetConfigForLevel(GameModel.Instance.currLevel);

        //reset dialogs
        (ObjectCache.instance.mainGameScreen as MainGameScreen).shop.Reset();

        playerScript.Init();

        dungeon.Init();
        Debug.Log("dungeon.Rooms.Count " + dungeon.Rooms.Count);
        if (dungeon.Rooms.Count < levelConfig.dungeon.numPacks)
        {
            Debug.LogError("dungeon.Rooms.Count < levelConfig.dungeon.numPacks");
            return(false);
        }
        dungeon._fog.transformList.Add(playerScript.transform);

        //set the player at a random position in room
        SetPlayerPosition();

        //number of doors
        int requiredDoors  = config.requiredNumDoors;
        int availableDoors = dungeon.GetNumSingleExit();
        int numSingleExitDoorsAvailable = (requiredDoors > availableDoors) ? availableDoors : requiredDoors;

        Debug.LogFormat("requiredDoors {0}", requiredDoors);
        Debug.LogFormat("Avail Sngle Exit {0}", dungeon.GetNumSingleExit());
        Debug.LogFormat("numDoors {0}", numSingleExitDoorsAvailable);

        if (numSingleExitDoorsAvailable == 0)
        {
            return(false);
            //throw new UnityException("Cannot have ZERO doors in game");
        }

        int reqNumOfKeys = numSingleExitDoorsAvailable - 1;

        reqNumOfKeys = (config.requiredNumKeys > reqNumOfKeys) ? reqNumOfKeys : config.requiredNumKeys;

        //find exit room
        List <int> lockedRoomIds            = new List <int>();
        List <int> availableSingleExitRooms = dungeon.SingleExitRoomIds();

        Debug.LogFormat("Num Keys {0}", reqNumOfKeys);

        //if available single exit door rooms is less than req num single exit doors
        //set the req to available
        if (availableSingleExitRooms.Count < numSingleExitDoorsAvailable)
        {
            numSingleExitDoorsAvailable = availableSingleExitRooms.Count;
        }

        Debug.Log("Player Current : RoomId " + playerScript.currentRoomId);

        for (int index = 0; index < numSingleExitDoorsAvailable; index++)
        {
            int   selectedLockedRooms = -1;
            float selectedDistance    = 0;
            foreach (var id in availableSingleExitRooms)
            {
                if (lockedRoomIds.Contains(id))
                {
                    continue;
                }
                Room    room    = dungeon.GetRoomById(id);
                Vector3 roomPos = room.roomData.roomRect.center;
                roomPos.z = roomPos.y;
                roomPos.y = 0;
                bool didFailed = true;
                try
                {
                    float distance = PathFinder.GetInstance().GetDistanceBetween(playerScript.transform.position, roomPos);
                    if (distance > selectedDistance)
                    {
                        selectedDistance    = distance;
                        selectedLockedRooms = id;
                    }
                }
                catch (System.Exception ex)
                {
                    if (ex != null)
                    {
                        Debug.Log(ex.Message);
                    }
                    didFailed = false;
                }
                if (didFailed == false)
                {
                    return(false);
                }
            }
            lockedRoomIds.Add(selectedLockedRooms);
        }

        //select exit room id
        int exitRoomId = -1;

        //if locked room count is zero, get random room id
        if (lockedRoomIds.Count == 0)
        {
            List <int> availableRoomIds = Utility.CloneList(dungeon.GetRoomIdsExcept(new List <int>()
            {
                playerScript.currentRoomId
            }));
            exitRoomId = Utility.GetRandomNumber(availableRoomIds);
        }
        else
        {
            exitRoomId = Utility.GetRandomNumber(lockedRoomIds);
        }

        //add exit door
        Debug.Log("ExitRoomId " + exitRoomId);
        dungeon.AddExitDoor(exitRoomId);

        //add keys
        List <int> keyExcludeIds = new List <int>()
        {
            playerScript.currentRoomId
        };

        keyExcludeIds.AddRange(lockedRoomIds);

        List <Key> keys = new List <Key>();

        if (reqNumOfKeys > 0)
        {
            Debug.Log("---------Generating Keys-------------------");
            keys = PopulateKeys(reqNumOfKeys, keyExcludeIds);
        }
        ObjectCache.instance.keyInfo.SetNumKeys(keys.Count);

        //add spikes
        if (config.requiredNumSpikes > 0)
        {
            Debug.Log("---------Generating Spikes------------------- " + config.requiredNumSpikes);
            PopulateSpikes(config.requiredNumSpikes, 1, keyExcludeIds);
        }

        //Update door info
        List <ExitObject> exitObjects = new List <ExitObject>();
        int runningKeyIndex           = 0;

        foreach (var roomId in lockedRoomIds)
        {
            if (roomId != exitRoomId)
            {
                Room room = dungeon.GetRoomById(roomId);
                //add key info for door
                if (keys.Count > runningKeyIndex)
                {
                    room.roomData.dungeonElements.doors[0].AddKeyInfo(keys[runningKeyIndex++]);
                }

                //add exit object
                ExitObject exitObj = AddExitObject(roomId);
                exitObjects.Add(exitObj);

                //add exit object to inventory
                room.roomData.dungeonElements.AddExitObject(exitObj);
            }
        }

        ObjectCache.instance.lockInfo.SetLockHUDByCount(exitObjects.Count);

        //add Shop
        Debug.Log("---------Generating Shop-------------------");
        List <int> lockedRoomsIds = new List <int>();

        foreach (var roomId in lockedRoomIds)
        {
            if (roomId != exitRoomId)
            {
                lockedRoomsIds.Add(roomId);
            }
        }
        if (lockedRoomsIds.Count > 0)
        {
            PopulateShop(lockedRoomsIds);
        }

        //add exit door info
        dungeon.GetRoomById(exitRoomId).roomData.dungeonElements.exitDoors[0].AddExitObject(exitObjects);
        dungeon.exitObjects = exitObjects;

        //add exit object for actual exit
        ExitObject actualExitObject = AddExitObject(exitRoomId);

        dungeon.GetRoomById(exitRoomId).roomData.dungeonElements.AddExitObject(actualExitObject);
        actualExitObject.isLevelExit = true;

        List <int> excludeRoomIds = new List <int>();

        excludeRoomIds.Add(playerScript.currentRoomId);
        //choose falling floor tiles
        if (config.requiredNumFallingTiles > 0)
        {
            Debug.Log("---------Generating Falling Tiles-------------------");
            excludeRoomIds.AddRange(lockedRoomIds);
            ChooseFallingFloorTiles(config.requiredNumFallingTiles, excludeRoomIds);
        }

        //populate life items
        if (config.requiredNumFallingTiles > 0)
        {
            Debug.Log("---------Generating Life Items-------------------");
            PopulateLifeItems(config.requiredNumHealth, excludeRoomIds);
        }

        //populate diamond
        if (config.requiredNumDiamonds > 0)
        {
            Debug.Log("---------Generating Diamond Items-------------------");
            PopulateDiamondItems(config.requiredNumDiamonds, excludeRoomIds);
        }

        float distanceToExit = 0f;

        foreach (var room in dungeon.Rooms)
        {
            foreach (var item in room.roomData.dungeonElements.exitObjects)
            {
                Vector3 roomPos = dungeon.GetRoomById(room.roomData.id).roomData.roomRect.center;
                roomPos.z       = roomPos.y;
                roomPos.y       = 0;
                distanceToExit += PathFinder.GetInstance().GetDistanceBetween(playerScript.transform.position, roomPos);
            }
            foreach (var item in room.roomData.dungeonElements.keys)
            {
                Vector3 roomPos = dungeon.GetRoomById(room.roomData.id).roomData.roomRect.center;
                roomPos.z       = roomPos.y;
                roomPos.y       = 0;
                distanceToExit += PathFinder.GetInstance().GetDistanceBetween(playerScript.transform.position, roomPos);
            }
        }

        Vector3 exitRoomPos = dungeon.GetRoomById(exitRoomId).roomData.roomRect.center;

        exitRoomPos.z   = exitRoomPos.y;
        exitRoomPos.y   = 0;
        distanceToExit += PathFinder.GetInstance().GetDistanceBetween(playerScript.transform.position, exitRoomPos);

        calculatedSeconds = (int)((distanceToExit / _charScript.MOVE_VELOCITY) * levelConfig.secondsMultiplier * 10f);
        Debug.LogFormat("Distance {0} Time to Finish {1}", distanceToExit, calculatedSeconds);

        PlayGameStartAnim();

        return(true);
    }
        public static Vault XMLToVault(XmlDocument vaultData)
        {
            XmlElement root = vaultData ["map"];

            XmlNodeList properties = root.GetElementsByTagName("property");
            int         minDepth = -1, maxDepth = -1;
            string      vaultType;

            foreach (XmlNode p in properties)
            {
                switch (p.Attributes ["name"].Value)
                {
                case "Min Depth":
                    minDepth = int.Parse(p.Attributes ["value"].Value);
                    break;

                case "Max Depth":
                    maxDepth = int.Parse(p.Attributes ["value"].Value);
                    break;

                case "vault Type":
                    vaultType = p.Attributes ["value"].Value;
                    break;
                }
            }


            int         width    = int.Parse(root.GetAttribute("width"));
            int         height   = int.Parse(root.GetAttribute("height"));
            Coordinates tileSize = new Coordinates(
                int.Parse(root.GetAttribute("tilewidth")),
                int.Parse(root.GetAttribute("tileheight"))
                );

            Coordinates size = new Coordinates(width, height);

            string        csv = root.GetElementsByTagName("data")[0].InnerText;
            StringBuilder b   = new StringBuilder(csv);

            b.Replace("\r", "").Replace("\n", "");

            Vault va = new Vault();

            va.minDepth = minDepth;
            va.maxDepth = maxDepth;
            va.size     = size;
            va.wallCsv  = b.ToString();
//			va.spikeCsv
            csv = root.GetElementsByTagName("data")[1].InnerText;
            b   = new StringBuilder(csv);
            b.Replace("\r", "").Replace("\n", "");
            va.spikeCsv = csv.ToString();



            va.objects = new List <TiledObject> ();
            int         exitCount = 0;
            XmlNodeList objects   = root.GetElementsByTagName("object");

            foreach (XmlNode o in objects)
            {
                TiledObject obj = new TiledObject();
                switch (o.Attributes ["type"].Value)
                {
                case "Exit":
                    obj = new ExitObject();
                    exitCount++;
                    break;
                }

                obj.position = new Coordinates(
                    int.Parse(o.Attributes ["x"].Value) / tileSize.x,
                    int.Parse(o.Attributes ["y"].Value) / tileSize.y
                    );

                obj.size = new Coordinates(
                    int.Parse(o.Attributes ["width"].Value) / tileSize.x,
                    int.Parse(o.Attributes ["height"].Value) / tileSize.y
                    );
                va.objects.Add(obj);
            }

            if (exitCount > 0)
            {
                va.type = VaultType.Configured;
            }
            return(va);
        }
Beispiel #14
0
 public void AddExitObject(ExitObject obj)
 {
     exitDoorKey.Add(obj);
 }