/// <summary> /// The user has attempted to initiate a change in /// partition; this function makes sure that it is /// a legal move. /// </summary> /// <param name="targetPartition">Target partition.</param> /// <param name="panDirection">Pan direction.</param> /// <param name="swipeTime">Swipe time.</param> private bool CanMoveToPartition(int targetPartition, RoomDirection panDirection) { bool retVal = true; // then check to make sure the gating manager is okay with the move if (GatingManager.Instance.CanEnterRoom(currentLocalPartition, panDirection) == false) { retVal = false; } // also check to make sure that the HUD animator is not animating if (HUDUIManager.Instance && HUDUIManager.Instance.hudAnimator && HUDUIManager.Instance.hudAnimator.IsAnimating) { retVal = false; } // if the user is in deco mode and the room they are moving to has an active gate, illegal move if (DecoModeUIManager.Instance && DecoModeUIManager.Instance.IsOpen && GatingManager.Instance.HasActiveGate(targetPartition)) { retVal = false; } // if the shop is open, no movement allowed if (StoreUIManager.Instance && StoreUIManager.Instance.IsOpen) { retVal = false; } // if we get here, the move is valid return(retVal); }
// Creates the "graph" of the level and the room coordinates private int CreateBranch(Room previousRoom, RoomCoordinates coordinates, int numberOfRoomsCreated) { var branchLength = Random.Range(1, 4); var previousBranchRoom = previousRoom; var branchCoordinates = coordinates; while (branchLength > 0) { try { RoomDirection direction = DetermineNextRoomLocation(branchCoordinates); branchCoordinates = DetermineNewCoordinates(direction, branchCoordinates); if (_floorGrid.CanRoomBeAdded(branchCoordinates.X, branchCoordinates.Y)) { previousBranchRoom = AddNewRoom(previousBranchRoom, direction, branchCoordinates); numberOfRoomsCreated++; } } catch (Exception) { Debug.Log("Branching failed :("); break; } branchLength--; } return(numberOfRoomsCreated); }
public void AddRoom(Room otherRoom, RoomDirection roomDirection) { if (otherRoom == this) { throw new InvalidOperationException("Can't add a room to itself"); } switch (roomDirection) { case RoomDirection.North: North = otherRoom; break; case RoomDirection.South: South = otherRoom; break; case RoomDirection.East: East = otherRoom; break; case RoomDirection.West: West = otherRoom; break; } }
//public List<RoomDirection> DirectionsAvailable() //{ // var dirAvailable = new List<RoomDirection>(); // for (var key in ) //} public void InsertSibling(RoomDirection dir) { ESCRoom newRoom = maze.RequestRoom(); if (newRoom.type != RoomType.Exit) { newRoom.GenerateDirectionPockets(dir); } Siblings[dir] = newRoom; SiblingsAlive++; }
private Room AddNewRoom(Room previousRoom, RoomDirection direction, RoomCoordinates coordinates, RoomType roomType = RoomType.NormalRoom) { var newRoom = CreateRoom(previousRoom, direction, roomType); if (previousRoom != null) { previousRoom.SetAdjacentRoom(newRoom, direction); newRoom.SetAdjacentRoom(previousRoom, GetOppositeRoomDirection(direction)); } _floorGrid.AddRoom(coordinates.X, coordinates.Y, newRoom); previousRoom = newRoom; return(previousRoom); }
// Room constructor: block texture, floor texture, room direction, and color. public Room(Texture2D blockSpr, Texture2D floorSpr, RoomDirection roomDirection, Color color) { this.blockSpr = blockSpr; this.floorSpr = floorSpr; this.roomDirection = roomDirection; this.floorColor = color; this.wallColor = this.floorColor; this.wallColor.R += 100; this.wallColor.G += 100; this.wallColor.B += 100; walls = new Entity[11][]; for (int i = 0; i < this.walls.Length; i++) { this.walls[i] = new Entity[9]; } }
/// <summary> /// Determines whether the player can enter room. /// </summary> /// <returns><c>true</c> if player can enter room ie player is moving from a smog room; otherwise, <c>false</c>.</returns> /// <param name="currentRoom">Current room.</param> /// <param name="eSwipeDirection">E swipe direction.</param> public bool CanEnterRoom(int currentLocalPartition, RoomDirection swipeDirection) { // start off optimistic bool isAllowed = true; // if there is an active gate in this room, check to see if it is blocking the direction the player is trying to go in ImmutableDataGate dataGate = DataLoaderGate.GetData(currentZone, currentLocalPartition); if (dataGate != null && DataManager.Instance.GameData.GatingProgress.IsGateActive(dataGate.GateID) && dataGate.DoesBlock(swipeDirection)) { isAllowed = false; } return(isAllowed); }
public void GenerateDirectionPockets(RoomDirection parentDirection) { Siblings = new Dictionary <RoomDirection, ESCRoom>(); var roomDirections = new List <RoomDirection>(Enum.GetValues(typeof(RoomDirection)).Cast <RoomDirection>().ToList()); roomDirections.Remove(parentDirection); Siblings.Add(parentDirection, null); int siblingsCount = ESCUtil.Rand.Next(2, 3 + 1); for (var i = 0; i < siblingsCount; i++) { RoomDirection dir = roomDirections[0]; roomDirections.RemoveAt(0); Siblings.Add(dir, null); } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { //Add the start room to the list as well roomPositions.Add(new Vector3(0, 0, 0)); //Get the room scene roomScene = ResourceLoader.Load("res://Scenes/BaseRoom.tscn") as PackedScene; //Place the first room GenerateRoom(new Vector3(-50, 0, 0)); //Add the room to the room positions roomPositions.Add(new Vector3(-50, 0, 0)); //Set the last location lastLocation = new Vector3(-50, 0, 0); //We placed the room manual in the front so we set it manualy newRoomDirection = RoomDirection.FRONT; lastRoomDirection = newRoomDirection; //Randomly seed random number generator when starting the game rng.Seed = OS.GetTicksMsec(); }
private RoomCoordinates DetermineNewCoordinates(RoomDirection direction, RoomCoordinates previousCoordinates) { switch (direction) { case RoomDirection.North: return(new RoomCoordinates(previousCoordinates.X, previousCoordinates.Y + 1)); case RoomDirection.East: return(new RoomCoordinates(previousCoordinates.X + 1, previousCoordinates.Y)); case RoomDirection.South: return(new RoomCoordinates(previousCoordinates.X, previousCoordinates.Y - 1)); case RoomDirection.West: return(new RoomCoordinates(previousCoordinates.X - 1, previousCoordinates.Y)); default: return(previousCoordinates); } }
void m_moveItem(GameObject go, string newRoom, string newID, RoomDirection newDir) { //Debug.Log ("Moving " + go.name + " to " + newRoom + " at position: " + newID + " direction: " + newDir); PersistentItem item = go.GetComponent <PersistentItem> (); //Remove the current data. item.StoreData(); refreshPersItems(); DelCharData(item.data); //load the list of things in the new room and add the current character to it CharacterSaveContainer cc = LoadChars(savePath + newRoom); item.data.targetID = newID; item.data.targetDir = newDir; cc.actors.Add(item.data); //Debug.Log ("What is this anyways?: " + item.data.targetID + " : " + item.data.targetDir); Save(savePath + newRoom, cc); ResaveRoom(); LoadChars(savePath + curRoom); }
public ImmutableDataGate(string id, IXMLNode xmlNode, string error) { Hashtable hashElements = XMLUtils.GetChildren(xmlNode); gateID = id; gateNumber = XMLUtils.GetInt(hashElements["GateNumber"] as IXMLNode, -1, error); zone = XMLUtils.GetString(hashElements["Zone"] as IXMLNode, null, error); absolutePartition = XMLUtils.GetInt(hashElements["AbsolutePartition"] as IXMLNode, 0, error); localPartition = XMLUtils.GetInt(hashElements["LocalPartition"] as IXMLNode, 0, error); screenPercentage = XMLUtils.GetFloat(hashElements["ScreenPercentage"] as IXMLNode, 30, error); // get monster monsterID = XMLUtils.GetString(hashElements["MonsterID"] as IXMLNode, null, error); // get whether or not the gate recurs isRecurring = XMLUtils.GetBool(hashElements["Recurring"] as IXMLNode, false); // get the direction the gate is blocking swipeDirection = (RoomDirection)System.Enum.Parse(typeof(RoomDirection), XMLUtils.GetString(hashElements["Blocking"] as IXMLNode, null, error)); // get list of wellapad unlocks if (hashElements.ContainsKey("TaskUnlocks")) { string strUnlocks = XMLUtils.GetString(hashElements["TaskUnlocks"] as IXMLNode); taskUnlocks = strUnlocks.Split(","[0]); } if (hashElements.ContainsKey("MiniPetID")) { miniPetID = XMLUtils.GetString(hashElements["MiniPetID"] as IXMLNode, null, error); } //Debug.Log("Loading gate " + strID + " in loc " + strArea + " in partition " + nPartition + " and monster " + strMonsterID); }
public bool checkRoomDirection(RoomDirection roomDir) => ((int)this.roomDirection & (int)roomDir) > 0;
// Creates the room with coordinates and instantiate the enemies private Room CreateRoom(Room previousRoom, RoomDirection direction, RoomType roomType = RoomType.NormalRoom) { Room prefab; // Type of the room switch (roomType) { case RoomType.StartRoom: prefab = _firstRoom; break; case RoomType.NormalRoom: prefab = _roomPrefabs.First(); break; case RoomType.BossRoom: prefab = _bossRoom; break; case RoomType.DevilRoom: prefab = _devilRoom; break; case RoomType.AngelRoom: prefab = _angelRoom; break; default: throw new ArgumentOutOfRangeException("roomType"); } var room = (Room)Instantiate(prefab); // Direction of the room if (previousRoom != null) { var position = previousRoom.transform.position; switch (direction) { case RoomDirection.North: position.y += VerticalDelta; break; case RoomDirection.East: position.x += HorizontalDelta; break; case RoomDirection.South: position.y -= VerticalDelta; break; case RoomDirection.West: position.x -= HorizontalDelta; break; } room.transform.position = position; } // Instantiate boss and normal enemies according to level if (roomType == RoomType.BossRoom) { var enemyLayouts = room.GetComponent <EnemyLayout> ().EnemyLayouts; var enemyLayout = (GameObject)Instantiate(enemyLayouts.ElementAt(level - 1)); //.ElementAt(Random.Range(0, enemyLayouts.Count))); //enemyLayout.transform.localPosition = Vector3.zero; enemyLayout.transform.parent = room.transform; var enemies = enemyLayout.GetComponentsInChildren <Enemy> ().ToList(); enemies.ForEach(e => room.AddEnemy(e, e.transform.position)); } else if (roomType == RoomType.AngelRoom || roomType == RoomType.DevilRoom) { var enemyLayouts = room.GetComponent <EnemyLayout> ().EnemyLayouts; var enemyLayout = (GameObject)Instantiate(enemyLayouts.ElementAt(0)); //.ElementAt(Random.Range(0, enemyLayouts.Count))); enemyLayout.transform.parent = room.transform; var enemies = enemyLayout.GetComponentsInChildren <Enemy> ().ToList(); enemies.ForEach(e => room.AddEnemy(e, e.transform.position)); } else if (roomType == RoomType.NormalRoom) { // Adds a random layout to the room var obstacleLayout = (GameObject)Instantiate(_obstacleLayouts.ElementAt(Random.Range(0, _obstacleLayouts.Count))); obstacleLayout.transform.parent = room.transform; obstacleLayout.transform.localPosition = Vector3.zero; // Add enemies for rooms type normal var enemyLayouts = obstacleLayout.GetComponent <EnemyLayout>().EnemyLayouts; /* This will check the level and read the array of enemies * It will help to set the number of enemies in a room per level */ int startArrayFrom = 0, endArrayAt = enemyLayouts.Count; switch (level) { case (1): startArrayFrom = 0; endArrayAt = 6; break; case (2): startArrayFrom = 0; endArrayAt = 9; break; case (3): startArrayFrom = 1; endArrayAt = 9; break; case (4): startArrayFrom = 1; endArrayAt = 13; break; case (5): startArrayFrom = 7; endArrayAt = 15; break; default: break; } if (enemyLayouts.Count == 0) { Debug.Log("Empty list of enemies"); } else { var enemyLayout = (GameObject)Instantiate(enemyLayouts.ElementAt(Random.Range(startArrayFrom, endArrayAt))); //enemyLayout.transform.localPosition = Vector3.zero; enemyLayout.transform.parent = room.transform; var enemies = enemyLayout.GetComponentsInChildren <Enemy> ().ToList(); enemies.ForEach(e => room.AddEnemy(e, e.transform.position)); } } return(room); }
public static void MoveItem(GameObject gm, string newRoom, string newID, RoomDirection newDir) { Instance.m_moveItem(gm, newRoom, newID, newDir); }
private void PlaceExitWall(RoomDirection location) { //Swing the directions back should become forward and so on if (exitPlaced) { return; } switch (location) { case RoomDirection.BACK: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, backWall.Transform.origin); exitWall.RotateY(Mathf.Deg2Rad(90)); AddChild(exitWall); backWall.QueueFree(); //Instance the exit wall her and position it to align break; case RoomDirection.FRONT: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, frontWall.Transform.origin); exitWall.RotateY(Mathf.Deg2Rad(-90)); AddChild(exitWall); frontWall.QueueFree(); break; case RoomDirection.LEFT: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, leftWall.Transform.origin); AddChild(exitWall); leftWall.QueueFree(); break; case RoomDirection.RIGHT: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, rightWall.Transform.origin); AddChild(exitWall); rightWall.QueueFree(); break; case RoomDirection.TOP: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, roofWall.Transform.origin); exitWall.RotateX(Mathf.Deg2Rad(90)); AddChild(exitWall); roofWall.QueueFree(); break; case RoomDirection.BOTTOM: //Create the exit wall exitWall = (KinematicBody)exitWallScene.Instance(); exitWall.Transform = new Transform(exitWall.Transform.basis, floorWall.Transform.origin); exitWall.RotateX(Mathf.Deg2Rad(-90)); AddChild(exitWall); floorWall.QueueFree(); break; } }
private static RoomDirection GetOppositeRoomDirection(RoomDirection direction) { return((RoomDirection)(((int)direction + 2) % 4)); }
void EnteringAnimation(RoomDirection roomDir) { }
private void AddAdjacentRoom(RoomDirection direction) { int roomID = GetNewRoomId(); }
//Take a step in the program so that we get the location of a room private void TakeStep() { //Init the new location to zero Vector3 newLocation = Vector3.Zero; //If the new location is accepteble we set it to true after the check loops bool locationGood = false; do { //Stores the temp location until it verified it is open Vector3 tempLocation = new Vector3(); //check to exit the direction finding loop bool directionGood = false; do { //Seed the random generator rng.Seed = OS.GetTicksUsec(); //Get the random direction from the random number generator newRoomDirection = (RoomDirection)rng.RandiRange(0, 5); directionGood = true; if (lastRoomDirection == RoomDirection.FRONT && newRoomDirection == RoomDirection.BACK) { directionGood = false; } if (lastRoomDirection == RoomDirection.BACK && newRoomDirection == RoomDirection.FRONT) { directionGood = false; } if (lastRoomDirection == RoomDirection.TOP && newRoomDirection == RoomDirection.BOTTOM) { directionGood = false; } if (lastRoomDirection == RoomDirection.BOTTOM && newRoomDirection == RoomDirection.TOP) { directionGood = false; } if (lastRoomDirection == RoomDirection.LEFT && newRoomDirection == RoomDirection.RIGHT) { directionGood = false; } if (lastRoomDirection == RoomDirection.RIGHT && newRoomDirection == RoomDirection.LEFT) { directionGood = false; } } while (!directionGood); //calculate the the new position depending on the placement switch (newRoomDirection) { case RoomDirection.BACK: tempLocation = lastLocation + new Vector3(50, 0, 0); break; case RoomDirection.FRONT: tempLocation = lastLocation + new Vector3(-50, 0, 0); break; case RoomDirection.LEFT: tempLocation = lastLocation + new Vector3(0, 0, 50); break; case RoomDirection.RIGHT: tempLocation = lastLocation + new Vector3(0, 0, -50); break; case RoomDirection.TOP: tempLocation = lastLocation + new Vector3(0, 50, 0); break; case RoomDirection.BOTTOM: tempLocation = lastLocation + new Vector3(0, -50, 0); break; } //Loop through the locations and chehk if they are going to be adjacent //if they are not going to be adjecant then set locationGood to true //8 hours left and I'm doing this without optimization, what am I doing with my life!? Hope it work first time???????? //PS. It did not work the first time, mother F*CKER!!!!!!!! //Working halway only 6 hours left, sfgmalkanva;lsdnla jdnlskefnasl jnv for (int i = 0; i < roomPositions.Count; i++) { //We set the lacationGood to true if any collisions of rooms are present it will be set to false for the remainder of the loop locationGood = true; if (tempLocation == roomPositions[i]) { locationGood = false; } //If we allow the last position a room was spawend to be checked there will be a false return if (lastLocation != roomPositions[i]) { // if ((tempLocation + new Vector3(0, 50, 0)) == roomPositions[i] || (tempLocation + new Vector3(0, 50, 0)) == lastLocation) if ((tempLocation + new Vector3(0, 50, 0)) == roomPositions[i]) { locationGood = false; } //if ((tempLocation + new Vector3(0, -50, 0)) == roomPositions[i] || (tempLocation + new Vector3(0, -50, 0)) == lastLocation) if ((tempLocation + new Vector3(0, -50, 0)) == roomPositions[i]) { locationGood = false; } // if ((tempLocation + new Vector3(50, 0, 0)) == roomPositions[i] || (tempLocation + new Vector3(50, 0, 0)) == lastLocation) if ((tempLocation + new Vector3(50, 0, 0)) == roomPositions[i]) { locationGood = false; } //if ((tempLocation + new Vector3(-50, 0, 0)) == roomPositions[i] || (tempLocation + new Vector3(-50, 0, 0)) == lastLocation) if ((tempLocation + new Vector3(-50, 0, 0)) == roomPositions[i]) { locationGood = false; } // if ((tempLocation + new Vector3(0, 0, 50)) == roomPositions[i] || (tempLocation + new Vector3(0, 0, 50)) == lastLocation) if ((tempLocation + new Vector3(0, 0, 50)) == roomPositions[i]) { locationGood = false; } // if ((tempLocation + new Vector3(0, 0, -50)) == roomPositions[i] || (tempLocation + new Vector3(0, 0, -50)) == lastLocation) if ((tempLocation + new Vector3(0, 0, -50)) == roomPositions[i]) { locationGood = false; } } } //If the location is good we set the new location to the tempLacation if (locationGood) { //If we get a valid location we set the old location to the new lacation for the next interation lastRoomDirection = newRoomDirection; //Set the new locaion becuase it is now valid newLocation = tempLocation; } //If the lacation is good we exit out of the loop, I hope } while (!locationGood); //Add the room locations so that the can be cros compared so we dont make rooms adjecent to each other roomPositions.Add(newLocation); //Set the last placed rooms ocation so when we place the next one we use this location to calculate the new position of the new room lastLocation = newLocation; GenerateRoom(newLocation); }
private Room CreateRoom(Room previousRoom, RoomDirection direction, RoomType roomType = RoomType.NormalRoom) { Room prefab; switch (roomType) { case RoomType.StartRoom: prefab = FirstRoom; break; case RoomType.NormalRoom: prefab = RoomPrefabs.First(); break; case RoomType.BossRoom: prefab = BossRoom; break; case RoomType.TreasureRoom: prefab = TreasureRoom; break; case RoomType.SecretRoom: prefab = RoomPrefabs.First(); break; default: throw new ArgumentOutOfRangeException("roomType"); } var room = (Room)Instantiate(prefab); if (previousRoom != null) { var position = previousRoom.transform.position; switch (direction) { case RoomDirection.North: position.y += VerticalDelta; break; case RoomDirection.East: position.x += HorizontalDelta; break; case RoomDirection.South: position.y -= VerticalDelta; break; case RoomDirection.West: position.x -= HorizontalDelta; break; } room.transform.position = position; } if (roomType == RoomType.BossRoom) { var enemyLayouts = room.GetComponent <EnemyLayout>().EnemyLayouts; var enemyLayout = (GameObject)Instantiate(enemyLayouts.ElementAt(Random.Range(0, enemyLayouts.Count))); //enemyLayout.transform.localPosition = Vector3.zero; enemyLayout.transform.parent = room.transform; var enemies = enemyLayout.GetComponentsInChildren <Enemy>().ToList(); enemies.ForEach(e => room.AddEnemy(e, e.transform.position)); } if (roomType == RoomType.NormalRoom) { var obstacleLayout = (GameObject)Instantiate(_obstacleLayouts.ElementAt(Random.Range(0, _obstacleLayouts.Count))); obstacleLayout.transform.parent = room.transform; obstacleLayout.transform.localPosition = Vector3.zero; var enemyLayouts = obstacleLayout.GetComponent <EnemyLayout>().EnemyLayouts; var enemyLayout = (GameObject)Instantiate(enemyLayouts.ElementAt(Random.Range(0, enemyLayouts.Count))); //enemyLayout.transform.localPosition = Vector3.zero; enemyLayout.transform.parent = room.transform; var enemies = enemyLayout.GetComponentsInChildren <Enemy>().ToList(); enemies.ForEach(e => room.AddEnemy(e, e.transform.position)); } return(room); }
protected virtual void changeRoom(GameObject go) { if (go.GetComponent <BasicMovement> ()) { if (go.GetComponent <Attackable> ().Alive == false) { return; } TriggerUsed = true; if (TriggerID != "none") { RoomDirection realDir = dir; string realTarget = TargetTriggerID; if (TargetTriggerID == "none") { realTarget = TriggerID; } if (realDir == RoomDirection.NEUTRAL) { float diffX = transform.position.x - go.transform.position.x; float diffY = transform.position.y - go.transform.position.y; if (Mathf.Abs(diffX) > Mathf.Abs(diffY)) { if (diffX < 0f) { realDir = RoomDirection.LEFT; } else { realDir = RoomDirection.RIGHT; } } else { if (diffY > 0f) { realDir = RoomDirection.UP; } else { realDir = RoomDirection.DOWN; } } } if (go.GetComponent <PersistentItem>() != null) { SaveObjManager.MoveItem(go, sceneName, realTarget, realDir); } } else if (Vector2.Equals(Vector2.zero, newPos) && (go.GetComponent <PersistentItem>() != null)) { SaveObjManager.MoveItem(go, sceneName, go.gameObject.transform.position); } else if (go.GetComponent <PersistentItem>() != null) { SaveObjManager.MoveItem(go, sceneName, newPos); } if (go.GetComponent <BasicMovement> ().IsCurrentPlayer) { //GameManager.Instance.LoadRoom (sceneName); Initiate.Fade(sceneName, Color.black, 5.0f); } Destroy(go); } else { } }
/// <summary> /// Gets the target partition. /// Given a direction and a distance, what partition is the target? /// </summary> /// <returns>The target partition.</returns> /// <param name="moves">Step</param> /// <param name="swipeDirection">Swipe direction.</param> private int GetTargetPartition(int step, RoomDirection swipeDirection) { int change = swipeDirection == RoomDirection.Left ? step : -step; return(currentLocalPartition + change); }
public Door(Texture2D sprite, Texture2D hitbox, Vector2 startPos, RoomDirection roomDir) : base(sprite, hitbox, startPos) { this.roomDir = roomDir; }
protected override void onTrigger(GameObject interactor) { if (interactor != null) { if (interactor.GetComponent <Attackable> ().Alive == false) { return; } TriggerUsed = true; if (TriggerID != "none") { RoomDirection realDir = dir; string realTarget = TargetTriggerID; if (TargetTriggerID == "none") { realTarget = TriggerID; } if (realDir == RoomDirection.AUTO) { float diffX = transform.position.x - interactor.transform.position.x; float diffY = transform.position.y - interactor.transform.position.y; if (Mathf.Abs(diffX) > Mathf.Abs(diffY)) { if (diffX < 0f) { realDir = RoomDirection.LEFT; } else { realDir = RoomDirection.RIGHT; } } else { if (diffY > 0f) { realDir = RoomDirection.UP; } else { realDir = RoomDirection.DOWN; } } } if (interactor.GetComponent <PersistentItem>() != null) { SaveObjManager.MoveItem(interactor, NextSceneName, realTarget, realDir); } } else if (Vector2.Equals(Vector2.zero, newPos) && (interactor.GetComponent <PersistentItem>() != null)) { SaveObjManager.MoveItem(interactor, NextSceneName, interactor.gameObject.transform.position); } else if (interactor.GetComponent <PersistentItem>() != null) { SaveObjManager.MoveItem(interactor, NextSceneName, newPos); } if (true) //interactor.GetComponent<CharacterBase> ().IsCurrentPlayer) { //GameManager.Instance.LoadRoom (sceneName); { Initiate.Fade(NextSceneName, Color.black, 5.0f); } Destroy(interactor); } }
public bool DoesBlock(RoomDirection eSwipeDirection) { return(this.swipeDirection == eSwipeDirection); }
public void SetAdjacentRoom(Room room, RoomDirection direction) { var position = new Vector3(); var rotation = new Quaternion(); Door doorPrefab = DoorPrefab; if (RoomType == RoomType.NormalRoom || RoomType == RoomType.StartRoom) { switch (room.RoomType) { case RoomType.StartRoom: doorPrefab = DoorPrefab; break; case RoomType.NormalRoom: doorPrefab = DoorPrefab; break; case RoomType.BossRoom: doorPrefab = BossDoorPrefab; break; case RoomType.TreasureRoom: doorPrefab = TreasureRoomDoorPrefab; break; case RoomType.SecretRoom: doorPrefab = DoorPrefab; break; default: throw new ArgumentOutOfRangeException(); } } else if (RoomType == RoomType.BossRoom) { doorPrefab = BossDoorPrefab; } else if (RoomType == RoomType.TreasureRoom) { doorPrefab = TreasureRoomDoorPrefab; } else if (RoomType == RoomType.SecretRoom) { doorPrefab = DoorPrefab; } var door = (Door)Instantiate(doorPrefab); switch (direction) { case RoomDirection.North: position += new Vector3(0, 4); NorthDoor = door; door.Wall = NorthDoorWall; break; case RoomDirection.East: position += new Vector3(7, 0); rotation = Quaternion.Euler(0, 0, 270); EastDoor = door; door.Wall = EastDoorWall; break; case RoomDirection.South: position += new Vector3(0, -4); rotation = Quaternion.Euler(0, 0, 180); SouthDoor = door; door.Wall = SouthDoorWall; break; case RoomDirection.West: position += new Vector3(-7, 0); rotation = Quaternion.Euler(0, 0, 90); WestDoor = door; door.Wall = WestDoorWall; break; } door.ConnectingRoom = room; door.Direction = direction; door.transform.parent = transform; door.transform.localPosition = position; door.transform.rotation = rotation; door.OwnerRoom = this; _doors.Add(door); }
public void SetAdjacentRoom(Room room, RoomDirection direction) { var position = new Vector3(); var rotation = new Quaternion(); Door doorPrefab = _doorPrefab; if (_roomType == RoomType.NormalRoom || _roomType == RoomType.StartRoom) { switch (room._roomType) { case RoomType.StartRoom: doorPrefab = _doorPrefab; break; case RoomType.NormalRoom: doorPrefab = _doorPrefab; break; case RoomType.BossRoom: doorPrefab = _bossDoorPrefab; break; case RoomType.DevilRoom: doorPrefab = _bossDoorPrefab; break; case RoomType.AngelRoom: doorPrefab = _bossDoorPrefab; break; default: throw new ArgumentOutOfRangeException(); } } else if (_roomType == RoomType.BossRoom) { doorPrefab = _bossDoorPrefab; } // Sets the doors prefabs of the room and its position var door = (Door)Instantiate(doorPrefab); switch (direction) { case RoomDirection.North: position += new Vector3(0, 3.5f); NorthDoor = door; door.Wall = _northDoorWall; break; case RoomDirection.East: position += new Vector3(5.75f, 0); rotation = Quaternion.Euler(0, 0, 270); EastDoor = door; door.Wall = _eastDoorWall; break; case RoomDirection.South: position += new Vector3(0, -3.55f); rotation = Quaternion.Euler(0, 0, 180); SouthDoor = door; door.Wall = _southDoorWall; break; case RoomDirection.West: position += new Vector3(-5.79f, 0); rotation = Quaternion.Euler(0, 0, 90); WestDoor = door; door.Wall = _westDoorWall; break; } door.ConnectingRoom = room; door.Direction = direction; door.transform.parent = transform; door.transform.localPosition = position; door.transform.rotation = rotation; door.OwnerRoom = this; _doors.Add(door); }
void ExitingAnimation(RoomDirection roomDir) { }