void Update() { CoroutineManager.Tick(Time.deltaTime); if (Input.GetKeyDown(Key.R)) { ResetLevel(); } if (Input.GetKeyDown(Key.O)) { this._glContext.Close(); } /* * DEBUG */ var mousePos = new Vector2Int(Input.mouseX, Input.mouseY); WorldMousePosition = _cam.TransformPoint(mousePos.x, mousePos.y) - Vector2.right * (width / 2) * _cam.scaleX - Vector2.up * (height / 2) * _cam.scaleY; _debugText.TextValue = $"playerPos: {_level?.Player?.Position} | mouseWorld: {WorldMousePosition} | mapSize: {_caveLevelMap.TotalWidth} x {_caveLevelMap.TotalHeight}| oil: {oil}\r\n" + $"pickups: {((FlashbackManager.Instance != null) ? string.Join(", ", FlashbackManager.Instance.CollectedFlashPickupsNames) : null)} | animFrame: {_level?.Player?.Frame} | camScale: {_cam?.scale}\r\n" + $"Channel: {GameSoundManager.Instance?.CurrentChannel?.ID}/{GameSoundManager.Instance?.CurrentChannelId} | isplaying: {GameSoundManager.Instance?.CurrentChannel?.IsPlaying} | ispaused: {GameSoundManager.Instance?.CurrentChannel?.IsPaused}"; //$"camScale: {_cam.scale:0.00} | mousePos: {mousePos} | worldMousePos: {worldMousePos} | isWalk: {isWalkable}"; if (Debug) { GameSoundManager.Instance?.DebugSoundChannels(); } _level?.Player?.EnableRun(Input.GetKey(Key.LEFT_SHIFT)); if (Input.GetKeyDown(Key.U)) { ToogleDebug(WorldMousePosition); } DebugDrawBoundBox.DrawBounds(); LampReduceLight(); }
public void LoadLevel() { string[] tmxFiles = TmxFilesLoader.GetTmxFileNames("Level*.tmx"); var mapData = TiledMapParserExtended.MapParser.ReadMap(tmxFiles[0]); _level = new BaseLevel(_caveLevelMap, _cam); AddChild(_level); _gameHud = new GameHud(_level, _cam); DebugDrawBoundBox.level = _level; foreach (var sprite in _level.GetChildren().Where(s => s is Sprite)) { DebugDrawBoundBox.AddSprite((Sprite)sprite); } foreach (var sprite in _gameHud.GetChildrenRecursive().Where(s => s is Sprite)) { DebugDrawBoundBox.AddSprite((Sprite)sprite); } }