void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Enemy") && !inCombat) { inCombat = true; GameObject combat = new GameObject("CombatInstance"); combat.transform.position = transform.position; combat.AddComponent <CombatController>(); } if (other.gameObject.CompareTag("Door")) { LockedDoor door = other.gameObject.GetComponent <LockedDoor>(); if (!door) { return; } if (keysFound.Contains(door.keyToUnlock)) { playerUIController.PickupEvent("The door unlocks!"); Destroy(other.gameObject); } else { playerUIController.PickupEvent("You don't have the right key to open this door"); } } }
public override void Use(PlayerController player) { base.Use(player); Vector3 topOfPlayer = player.transform.position + (Vector3.up * player.CharControl.height); Collider[] overlaps = Physics.OverlapCapsule(player.transform.position, topOfPlayer, player.CharControl.radius); // Check if any collider is a door and use key if it matches // foreach (Collider c in overlaps) { if (!c.isTrigger) { continue; } LockedDoor tryDoor = c.GetComponent <LockedDoor>(); if (tryDoor) { if (tryDoor.TestKey(this)) { tryDoor.Interact(player); break; } } } }
public UnlockDoorCommand(Game1 game, Player player, LockedDoor door, CollisionSides side) { this.myGame = game; this.myPlayer = player; this.mySide = side; this.myDoor = door; roomID = myGame.currentGamePlayState.CurrentRoom.roomID; }
private void OnCollisionEnter(Collision collision) { LockedDoor lockedDoor = collision.gameObject.GetComponentInParent <LockedDoor>(); if (hasKey && lockedDoor) { Destroy(lockedDoor.gameObject); } }
public void OpenLockedDoor(SkillSystem.SkEntity caster, SkillSystem.SkEntity monster) { LockedDoor ld = generator.CurrentDungeon.LockedDoorList.Find(it => it.IsOpen == false); if (ld != null) { ld.Open(); } }
public List <ICollider> GetColliders() { List <ICollider> collidables = new List <ICollider>(); if (npcs.Count == 0) { foreach (IWorldItem x in worldItems) { collidables.Add((ICollider)x); } } foreach (IObstacle x in obstacles) { collidables.Add((ICollider)x); } foreach (INpc x in npcs) { collidables.Add((ICollider)x); } string[] adjacentRooms = Map.adjacencies[roomID]; int width = RoomTextureStorage.BORDER_WIDTH; int height = RoomTextureStorage.BORDER_HEIGHT; string[] strings = new string[] { "top", "bottom", "left", "right" }; for (int i = 0; i < 4; i++) { // This needs changed for locked doors behavior // Locked doors can be detected by adjacentRooms[i].EndsWith("1") if (adjacentRooms[i].EndsWith("1") && adjacentRooms[i] != "-1") { LockedDoor newDoor = new LockedDoor(strings[i], width, height); Wall newWall1 = new Wall(strings[i], width, height, false); Wall newWall2 = new Wall(strings[i], width, height, true); collidables.Add(newDoor); collidables.Add(newWall1); collidables.Add(newWall2); } else if (adjacentRooms[i] != "-1") { Door newDoor = new Door(strings[i], adjacentRooms[i], width, height); Wall newWall1 = new Wall(strings[i], width, height, false); Wall newWall2 = new Wall(strings[i], width, height, true); collidables.Add(newDoor); collidables.Add(newWall1); collidables.Add(newWall2); } else { collidables.Add(new Wall(strings[i], width, height)); } } return(collidables); }
} //Is the Green lever facing up // Start is called before the first frame update void Start() { lockedDoor = GameObject.Find("LockDoor").GetComponent <LockedDoor>(); //Connects the locked door script to this script moveWaterUp = GameObject.Find("Pool").GetComponent <MoveWaterUp>(); //Connects the Move water script to this script rotateLevers = GetComponent <RotateLevers>(); //Connects the Rotate lever script to this script isInteracted = false; isRedUp = true; isBlueUp = true; isGreenUp = true; }
public static void SavePlayer(Inventory inv, Damagable dmg, LockedDoor door) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/save.car"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(inv, dmg, door); formatter.Serialize(stream, data); stream.Close(); }
public PlayerData(Inventory inv, Damagable dmg, LockedDoor door) { this.inv = inv; health = dmg.health; doorStatus = door; position = new float[3]; position[0] = dmg.transform.position.x; position[1] = dmg.transform.position.y; position[2] = dmg.transform.position.z; }
public void OnDoorClicked() { if (unlocked) { opening = true; StartTime = Time.time; StartPositionY = transform.position.y; OpenDoor.Play(); } else { LockedDoor.Play(); } }
void Start() { _lockedDoor = GetComponentInParent <LockedDoor>(); TMP = GetComponent <TextMeshPro>(); //if a controller is connected if (Input.GetJoystickNames().Any()) { _controllerConnected = true; } StartCoroutine(CoBlinkSprite()); }
protected override void InteractWithPlayer() { if (door == null) door = this.gameObject.GetComponent<LockedDoor>(); GameObject playerItem = player.Inventory.GetItem(); if (playerItem == null) return; foreach (GameObject keyUnlock in door.keysThatUnlock){ if(playerItem == keyUnlock){ LockedDoorManager.instance.UnlockWithId(door.id); player.Inventory.DisableHeldItem(); break; } } }
public void takeKey(LockedDoor doorToDelete) { if (doorToDelete.type == "bronze") { bronzeKeys--; } if (doorToDelete.type == "silver") { silverKeys--; } if (doorToDelete.type == "gold") { goldKeys--; } }
public bool hasKey(LockedDoor doorToCheck) { if (doorToCheck.type == "bronze" && bronzeKeys > 0) { return(true); } if (doorToCheck.type == "silver" && silverKeys > 0) { return(true); } if (doorToCheck.type == "gold" && goldKeys > 0) { return(true); } return(false); }
private void GenerateLockedDoorsAndKeys() { // Generate a bunch of locked doors, and about half as many keys. // Locked doors tend to appear near the stairs down. int numToGenerate = Config.Instance.Get <int>("NumberLockedDoors"); int generated = 0; int radiusUsed = 4; var nearStairs = new List <ICell>(); while (generated < numToGenerate) { if (!nearStairs.Any()) { nearStairs = this.tileData.GetCellsInArea(this.stairsDown.X, this.stairsDown.Y, radiusUsed).OrderBy(r => random.Next(100)).ToList(); radiusUsed *= 2; } var spot = nearStairs.First(); nearStairs.Remove(spot); if (this.IsInHallway(spot.X, spot.Y)) { var door = new LockedDoor(); door.Move(spot.X, spot.Y); this.entities.Add(door); generated++; } } // Generate less keys than doors. If there's a block puzzle, // and if you can complete it, that'll give you an extra few keys. generated = 0; var numKeys = Math.Ceiling(2 * numToGenerate / 3f); while (generated < numKeys) { var spot = this.FindEmptyPosition(); var key = new Key(); key.Move(spot); this.entities.Add(key); generated++; } }
// Start is called before the first frame update void Start() { pauseMenu.SetActive(false); NextDoor.SetActive(false); LockedDoor.SetActive(false); CharBody = GetComponent <Rigidbody2D>(); if (TORSOpiecesRight.Length == 0 || TORSOpiecesLeft.Length == 0 || TORSOpiecesUp.Length == 0 || TORSOpiecesDown.Length == 0) { Debug.LogError("Catastrophic failure; missing some TORSO sprites for character."); } if (LEGpiecesRight.Length == 0 || LEGpiecesLeft.Length == 0 || LEGpiecesUp.Length == 0 || LEGpiecesDown.Length == 0) { Debug.LogError("Catastrophic failure; missing some LEG sprites for character."); } Torso.sprite = TORSOpiecesDown[0]; Legs.sprite = LEGpiecesDown[0]; SpriteUpdate = Time.time; DoorLock = Time.time; IsInDoorway = false; Health = 100; Healthbar.maxValue = Health; AttackCooldown = Time.time; GameObject PlayerAoE = new GameObject("PlayerAoE"); PlayerAoE.transform.SetParent(gameObject.transform); PlayerAoE.AddComponent <CircleCollider2D>(); HurtCircle = PlayerAoE.GetComponent <CircleCollider2D>(); HurtCircle.radius = 1.0f; HurtCircle.offset = new Vector2(0.0f, -0.1f); HurtCircle.isTrigger = true; PlayerAoE.tag = "AoE_Damage"; HurtCircle.enabled = false; }
private bool TryAddLockedDoor(MapTile tile, Point location) { BlockType blockType; Direction direction; // ReSharper disable once SwitchStatementMissingSomeCases switch (tile) { case MapTile.DoorLockedRight: blockType = BlockType.DoorLockedRight; direction = Direction.Right; break; case MapTile.DoorLockedLeft: blockType = BlockType.DoorLockedLeft; direction = Direction.Left; break; case MapTile.DoorLockedUp: blockType = BlockType.DoorLockedUp; direction = Direction.Up; break; case MapTile.DoorLockedDown: blockType = BlockType.DoorLockedDown; direction = Direction.Down; break; default: return(false); } var door = new LockedDoor(_dungeonManager, location, blockType); Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
// Update is called once per frame void Update() { if (ItemHandler.justPickedKey) { hasKey = true; GUIManager.SetDisplayText("Got Key!", 2); } if (ItemHandler.justPickedSword) { hasSword = true; GUIManager.SetDisplayText("Got Sword!", 2); } bool nearDoor = LockedDoor.playerEntered; if (nearDoor) { if (hasKey && hasSword) { LockedDoor.OpenDoor(); } else if (hasKey) { GUIManager.SetDisplayText("You still need a sword!", 3); } else if (hasSword) { GUIManager.SetDisplayText("You still need a key!", 3); } else { GUIManager.SetDisplayText("The door is locked! Find a key!", 3); } } }
private void OnGUI() { if (IsInDoorway) { GameObject temp = GameObject.Find("Enemy"); if (temp == null) { if (!IsDoorLocked) { NextDoor.SetActive(true); } else { LockedDoor.SetActive(true); } } } else { NextDoor.SetActive(false); LockedDoor.SetActive(false); } Healthbar.value = Health; }
private void OnTriggerEnter(Collider collider) { Key key = collider.GetComponent <Key>(); if (key != null) { AddKey(key.GetKeyType()); Destroy(key.gameObject); } LockedDoor lockedDoor = collider.GetComponent <LockedDoor>(); if (lockedDoor != null) { if (ContainsKey(lockedDoor.GetKeyType())) { lockedDoor.Open(); if (lockedDoor.tag == "Final") { SceneManager.LoadScene(sceneName); } } } }
void OnCollisionEnter(Collision collision) { GameObject collisionObject = collision.collider.gameObject; if (collisionObject.GetComponent <LockedDoor> () != null) { if (hasUnlockedUpLeft) { // Debug.Log ("Unlocking right! Left unlocked"); LockedDoor lockedDoor = collisionObject.GetComponent <LockedDoor> (); if (lockedDoor.lockedDirection == Direction.UP_RIGHT) { GameObject newDoor = Instantiate(unlockedUpRight, lockedDoor.transform.position, lockedDoor.transform.rotation); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); hasUnlockedUpLeft = false; return; } } if (hasUnlockedUpRight) { // Debug.Log ("Unlocking left! Right unlocked!"); LockedDoor lockedDoor = collisionObject.GetComponent <LockedDoor> (); if (lockedDoor.lockedDirection == Direction.UP_LEFT) { GameObject newDoor = Instantiate(unlockedUpLeft, lockedDoor.transform.position, lockedDoor.transform.rotation); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); hasUnlockedUpRight = false; return; } } if (inventory.numKeys >= 1) { LockedDoor lockedDoor = collisionObject.GetComponent <LockedDoor> (); if (lockedDoor.lockedDirection == Direction.UP_LEFT) { // Debug.Log ("Unlocking left!"); GameObject newDoor = Instantiate(unlockedUpLeft, lockedDoor.transform.position, lockedDoor.transform.rotation); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); inventory.numKeys--; hasUnlockedUpLeft = true; AudioSource.PlayClipAtPoint(unlockSound, Camera.main.transform.position); } else if (lockedDoor.lockedDirection == Direction.UP_RIGHT) { // Debug.Log ("Unlocking right!"); GameObject newDoor = Instantiate(unlockedUpRight, lockedDoor.transform.position, lockedDoor.transform.rotation); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); inventory.numKeys--; hasUnlockedUpRight = true; AudioSource.PlayClipAtPoint(unlockSound, Camera.main.transform.position); } else if (lockedDoor.lockedDirection == Direction.LEFT) { GameObject newDoor = Instantiate(unlockedLeft, lockedDoor.transform.position, Quaternion.identity); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); inventory.numKeys--; AudioSource.PlayClipAtPoint(unlockSound, Camera.main.transform.position); } else if (lockedDoor.lockedDirection == Direction.RIGHT) { GameObject newDoor = Instantiate(unlockedRight, lockedDoor.transform.position, Quaternion.identity); newDoor.transform.SetParent(collisionObject.transform.parent); Destroy(collisionObject); inventory.numKeys--; AudioSource.PlayClipAtPoint(unlockSound, Camera.main.transform.position); } } } }
// Start is called before the first frame update void Start() { levers = GameObject.Find("Red").GetComponent <Levers>(); //Connects the levers script to this one lockedDoor = GameObject.Find("LockDoor").GetComponent <LockedDoor>(); //Connects the Locked door script to this one delay = 0; //How long the door waits to move }
private static void SpawnWalls(SpriteBatch spriteBatch, IRoom room, string spawnType, int i) { IBlock blockType; Point position; if (i == 0) { position = new Point(RoomConstants.TopDoorX, RoomConstants.TopDoorY); } else if (i == 1) { position = new Point(RoomConstants.RightDoorX, RoomConstants.RightDoorY); } else if (i == 2) { position = new Point(RoomConstants.BottomDoorX, RoomConstants.BottomDoorY); } else if (i == 3) { position = new Point(RoomConstants.LeftDoorX, RoomConstants.LeftDoorY); } else { position = Point.Zero; } switch (spawnType) { case RoomConstants.WallPiece: blockType = new Walls(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.OpenDoor: blockType = new OpenedDoor(spriteBatch, position, room); room.AddDoor((IDoor)blockType); room.AllObjects.Spawn(blockType); break; case RoomConstants.LockedDoor: blockType = new LockedDoor(spriteBatch, position, room); room.AddDoor((IDoor)blockType); room.AllObjects.Spawn(blockType); break; case RoomConstants.ShutDoor: blockType = new ShutDoor(spriteBatch, position, room); room.AddDoor((IDoor)blockType); room.AllObjects.Spawn(blockType); break; case RoomConstants.BombableWall: blockType = new BombableOpening(spriteBatch, position, room); room.AddDoor((IDoor)blockType); room.AllObjects.Spawn(blockType); break; default: break; } }
public Map(string fileName, Game1 game, Mapper mapper, List <String> enemyList) { FileInputHandler fileIn = new FileInputHandler(game); tiles = fileIn.parseToArray(fileName); this.gameRef = game; this.mapper = mapper; this.enemyList = enemyList; loadList = new List <Sprite>(); int dim = 16; string s = ""; for (int x = 0; x < dim; x++) { for (int y = 0; y < dim; y++) { Vector2 position = new Vector2(x * 64, y * 64); s = this.tiles[y, x]; //if (s.Equals("0")) //{ // ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); // loadList.Add(ts); //} if (s.Contains("map_")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); loadList.Add(ts); string selectedBoss = s.Substring(s.IndexOf("_") + 1); Enemy bossObject; switch (selectedBoss) { case "clark": bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character); break; case "pay": bossObject = new JerryPay(gameRef.Character.Level, gameRef, gameRef.Character); break; case "fletcher": bossObject = new Fletcher(gameRef.Character.Level, gameRef, gameRef.Character); break; case "halliday": bossObject = new Halliday(gameRef.Character.Level, gameRef, gameRef.Character); break; case "king_james": bossObject = new Boss(gameRef.Character.Level, gameRef, gameRef.Character); break; default: bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character); break; } BossSprite combatSprite = new BossSprite(gameRef.Content.Load <Texture2D>(@"Images/map" + s.Substring(s.IndexOf('_'))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero, gameRef, bossObject); loadList.Add(combatSprite); } else if (s.Contains("3d")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; loadList.Add(ts); } else if (s.Contains("i")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); Treasure t = new Treasure(gameRef.Content.Load <Texture2D>(@"Images/mapItem"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(t); } else if (s.Contains("d")) { int i = 0; string mapID = s.Substring(1, 2); float placeAtX = (float.Parse(s.Substring(s.IndexOf(";") + 1, 2))) * 64; float placeAtY = (float.Parse(s.Substring(s.IndexOf("_") + 1, 2))) * 64; Door d = new Door(gameRef.Content.Load <Texture2D>(@"Images/tiled"), position, 0, mapID, mapper, new Vector2(placeAtX, placeAtY), gameRef); d.passable = false; d.isInteractable = true; loadList.Add(d); } else if (s.Contains("k")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); Key k = new Key(gameRef.Content.Load <Texture2D>(@"Images/key"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(k); } else if (s.Contains("l")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); LockedDoor ld = new LockedDoor(gameRef.Content.Load <Texture2D>(@"Images/lockedDoor"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(ld); } else if (s.Contains("s")) { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; ShopSprite ss = new ShopSprite(gameRef.Content.Load <Texture2D>(@"Images/shop"), position, 25, mapper, gameRef); loadList.Add(ts); loadList.Add(ss); } else if (s == "0") { int wallType = r.Next(0, 9); switch (wallType) { case 0: break; case 1: wallType = 0; break; case 2: wallType = 1; break; case 3: wallType = 1; break; case 4: wallType = 2; break; case 5: wallType = 2; break; case 6: wallType = 3; break; case 7: wallType = 1; break; case 8: wallType = 2; break; } ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/wallTile" + wallType), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; loadList.Add(ts); } else { ts = new TileSprite(gameRef.Content.Load <Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); if (s == "0" || s == "b") { ts.passable = false; } loadList.Add(ts); } } } }
// Start is called before the first frame update void Start() { lockedDoor = GameObject.Find("LockDoor").GetComponent <LockedDoor>(); //Connects the locked door script to this script }
void addDoor(String line) { float x; float y; //up, left, right, down String[] split = line.Split(','); int direction; IObject door; switch (split[1]) { case "up": x = screenX + (6 * blockBaseDimension * blockSizeMod) + ((blockBaseDimension * blockSizeMod)); y = screenY; direction = 0; break; case "left": y = screenY + (5 * blockBaseDimension * blockSizeMod) - blockBaseDimension; x = screenX; direction = 1; break; case "right": y = screenY + (5 * blockBaseDimension * blockSizeMod) - blockBaseDimension; x = screenX + (blockSizeMod * blockBaseDimension * 14); direction = 2; break; case "down": x = screenX + (6 * blockBaseDimension * blockSizeMod) + ((blockBaseDimension * blockSizeMod)); y = screenY + (9 * blockBaseDimension * blockSizeMod); direction = 3; break; default: x = 0; y = 0; direction = 0; break; } int nextDoor = int.Parse(split[2]); switch (split[0]) { //keys temporarily set to 0. may have to do switch later to determine room number case "closed": door = new ClosedDoor(direction, new Vector2(x, y), sprites["doors"], 0, false, nextDoor); break; case "open": door = new OpenDoor(direction, new Vector2(x, y), sprites["doors"], 0, false, nextDoor); break; case "cave": door = new CaveDoor(direction, new Vector2(x, y), sprites["doors"], nextDoor); break; case "locked": door = new LockedDoor(direction, new Vector2(x, y), sprites["doors"], 0, true, nextDoor); break; default: door = null; break; } Blocks.Add(door); }
public Map(string fileName, Game1 game, Mapper mapper, List<String> enemyList) { FileInputHandler fileIn = new FileInputHandler(game); tiles = fileIn.parseToArray(fileName); this.gameRef = game; this.mapper = mapper; this.enemyList = enemyList; loadList = new List<Sprite>(); int dim = 16; string s = ""; for (int x = 0; x < dim; x++) { for (int y = 0; y < dim; y++) { Vector2 position = new Vector2(x * 64, y * 64); s = this.tiles[y, x]; //if (s.Equals("0")) //{ // ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); // loadList.Add(ts); //} if (s.Contains("map_")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); loadList.Add(ts); string selectedBoss = s.Substring(s.IndexOf("_") + 1); Enemy bossObject; switch (selectedBoss) { case "clark": bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character); break; case "pay": bossObject = new JerryPay(gameRef.Character.Level, gameRef, gameRef.Character); break; case "fletcher": bossObject = new Fletcher(gameRef.Character.Level, gameRef, gameRef.Character); break; case "halliday": bossObject = new Halliday(gameRef.Character.Level, gameRef, gameRef.Character); break; case "king_james": bossObject = new Boss(gameRef.Character.Level, gameRef, gameRef.Character); break; default: bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character); break; } BossSprite combatSprite = new BossSprite(gameRef.Content.Load<Texture2D>(@"Images/map" + s.Substring(s.IndexOf('_'))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero, gameRef, bossObject); loadList.Add(combatSprite); } else if (s.Contains("3d")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; loadList.Add(ts); } else if (s.Contains("i")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); Treasure t = new Treasure(gameRef.Content.Load<Texture2D>(@"Images/mapItem"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(t); } else if (s.Contains("d")) { int i = 0; string mapID = s.Substring(1, 2); float placeAtX = (float.Parse(s.Substring(s.IndexOf(";") + 1, 2))) * 64; float placeAtY = (float.Parse(s.Substring(s.IndexOf("_") + 1, 2))) * 64; Door d = new Door(gameRef.Content.Load<Texture2D>(@"Images/tiled"), position, 0, mapID, mapper, new Vector2(placeAtX, placeAtY), gameRef); d.passable = false; d.isInteractable = true; loadList.Add(d); } else if (s.Contains("k")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); Key k = new Key(gameRef.Content.Load<Texture2D>(@"Images/key"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(k); } else if (s.Contains("l")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); LockedDoor ld = new LockedDoor(gameRef.Content.Load<Texture2D>(@"Images/lockedDoor"), position, 0, mapper, gameRef); loadList.Add(ts); loadList.Add(ld); } else if (s.Contains("s")) { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; ShopSprite ss = new ShopSprite(gameRef.Content.Load<Texture2D>(@"Images/shop"), position, 25, mapper, gameRef); loadList.Add(ts); loadList.Add(ss); } else if (s == "0") { int wallType = r.Next(0, 9); switch (wallType) { case 0: break; case 1: wallType = 0; break; case 2: wallType = 1; break; case 3: wallType = 1; break; case 4: wallType = 2; break; case 5: wallType = 2; break; case 6: wallType = 3; break; case 7: wallType = 1; break; case 8: wallType = 2; break; } ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/wallTile" + wallType), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); ts.passable = false; loadList.Add(ts); } else { ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero); if (s == "0" || s == "b") { ts.passable = false; } loadList.Add(ts); } } } }