private void Debug_FlipGravityForAllPlatformCharacters() { foreach (PlatformCharacter pc in CurrRoom.GetComponentsInChildren <PlatformCharacter>()) { pc.FlipGravity(); } }
public void StartGameAtRoom(RoomData rd, PlayerData playerData) { // Wipe everything totally clean. DestroyPlayer(); DestroyRoom(); dm.currRoomData = rd; // Make Room and Player! CurrRoom = Instantiate(ResourcesHandler.Instance.Room).GetComponent <Room>(); CurrRoom.Initialize(this, tf_world, rd); MakePlayer(playerData); // Tell the RoomData it's on! rd.OnPlayerEnterMe(); // Reset things! dm.ResetRoomEnterValues(); // Save what's up! SaveStorage.SetInt(SaveKeys.LastPlayedWorldIndex, rd.WorldIndex); SaveStorage.SetString(SaveKeys.LastPlayedRoomKey(rd.WorldIndex), rd.RoomKey); SaveStorage.SetFloat(SaveKeys.MapEditor_CameraPosX, rd.PosGlobal.x); SaveStorage.SetFloat(SaveKeys.MapEditor_CameraPosY, rd.PosGlobal.y); //// Use this opportunity to call SAVE with SaveStorage, yo! (This causes a brief stutter, so I'm opting to call it when the game is already loading.) //SaveStorage.Save(); // Dispatch the post-function event! eventManager.OnStartRoom(CurrRoom); }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Debug // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void Debug_JumpToRoomAtSide(int side) { OnPlayerEscapeRoomBounds(side); // Pretend the player just exited in this direction. Player.SetPosLocal(CurrRoom.Debug_PlayerStartPosLocal()); // just put the player at the PlayerStart. Player.SetVel(Vector2.zero); }