public void SetCameraMode(CameraMode mode) { switch (mode) { case CameraMode.Arena: ArenaCamera arenaCamera = new ArenaCamera(new Vector2((RetroGame.getMainLiveHero().levelX + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2, (RetroGame.getMainLiveHero().levelY + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2)); arenaCamera.Initialize(); if (Camera != null) { arenaCamera.InitializeWithCamera(Camera); } Camera = arenaCamera; break; case CameraMode.Escape: EscapeCamera escapeCamera; if (RetroGame.NUM_PLAYERS == 1) { escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero()); } else //if (RetroGame.NUM_PLAYERS == 2) { int liveHeroes = 0; foreach (Hero hero in RetroGame.getHeroes()) { if (hero.Alive) { liveHeroes++; } } if (liveHeroes == 1) { escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero()); } else { escapeCamera = new CoopEscapeCamera(RetroGame.getHeroes()[0], RetroGame.getHeroes()[1]); } } escapeCamera.Initialize(); if (Camera != null) { escapeCamera.InitializeWithCamera(Camera); } Camera = escapeCamera; break; } CameraMode = mode; }
public void SetCameraMode(CameraMode mode) { switch (mode) { case CameraMode.Arena: ArenaCamera arenaCamera = new ArenaCamera(new Vector2((RetroGame.getMainLiveHero().levelX + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2, (RetroGame.getMainLiveHero().levelY + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2)); arenaCamera.Initialize(); if (Camera != null) arenaCamera.InitializeWithCamera(Camera); Camera = arenaCamera; break; case CameraMode.Escape: EscapeCamera escapeCamera; if (RetroGame.NUM_PLAYERS == 1) escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero()); else //if (RetroGame.NUM_PLAYERS == 2) { int liveHeroes = 0; foreach(Hero hero in RetroGame.getHeroes()) if (hero.Alive) liveHeroes++; if (liveHeroes == 1) escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero()); else escapeCamera = new CoopEscapeCamera(RetroGame.getHeroes()[0], RetroGame.getHeroes()[1]); } escapeCamera.Initialize(); if (Camera != null) escapeCamera.InitializeWithCamera(Camera); Camera = escapeCamera; break; } CameraMode = mode; }