public GameAreaHandler(Guid playerId, WorldState state, SimpleMaze game, MazePlayer mazePlayer) { this.playerId = playerId; this.state = state; this.game = game; this.mazePlayer = mazePlayer;; }
private void StartGame(Guid firstPlayerId, Guid secondPlayerId) { var firstPlayer = new MazePlayer(state.Players[firstPlayerId]); var secondPlayer = new MazePlayer(state.Players[secondPlayerId]); var game = new SimpleMaze(state, firstPlayer, secondPlayer); state.Games.Add(game.GameId, game); state.Players[firstPlayer.Id].SetHandler(new GameAreaHandler(firstPlayer.Id, state, game, firstPlayer)); state.Players[secondPlayer.Id].SetHandler(new GameAreaHandler(secondPlayer.Id, state, game, secondPlayer)); }
void Update() { if (spawnObjectsOnPlane.placementModeActive || gameOver) { return; } // initialise scene with levels, as soon as plane detection has been completed if (!gameStarted) { Debug.Log("Start Game"); gameStarted = true; activeLevel = GameObject.FindWithTag("Respawn"); activeLevel.SetActive(false); for (int i = 0; i < levels.Length; i++) { GameObject newPrefab = Instantiate(levels[i], activeLevel.transform.position, activeLevel.transform.rotation); Vector3 eulerRotation = transform.rotation.eulerAngles; newPrefab.transform.rotation = Quaternion.Euler(0, eulerRotation.y, 0); newPrefab.name = levels[i].name; newPrefab.SetActive(false); spawnedlevels[i] = newPrefab; } spawnedlevels[0].SetActive(true); } // if ball has touched the goal or an area it shouldn't have to, update mini game progress player = GameObject.FindObjectOfType <MazePlayer>(); Debug.Log("gefunden: " + player.name); if (player.LevelCompleted()) { comletedLevels++; if (gameCompleted) { return; } else { Debug.Log("Level completed"); LevelCompleted(); } } if (player.LevelLost()) { Debug.Log("Level completed - No hits left"); gameOver = true; SaveMiniGame(); } }
private IEnumerator BeginGame() { Camera mainCam = Camera.main; mainCam.clearFlags = CameraClearFlags.Skybox; mainCam.rect = new Rect(0f, 0f, 1f, 1f); mazeInstance = Instantiate(mazePrefab); yield return(StartCoroutine(mazeInstance.Generate())); playerInstance = Instantiate(playerPrefab); playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates)); mainCam.clearFlags = CameraClearFlags.Depth; mainCam.rect = new Rect(0f, 0f, 0.5f, 0.5f); }
override public void moveToDestPos(MazePlayer mazePlayer_) { base.moveToDestPos(mazePlayer_); mazePlayer_.mazePlayerTrackAniControl.moveToDestPos(this); }
override public void moveToDestPos(MazePlayer mazePlayer_) { base.moveToDestPos(mazePlayer_); mazePlayer_.mazePlayerTrackAniControl.moveToDestPos(this); }
public void NextLevel() { levelSuccessCanvas.SetActive(false); spawnedlevels[comletedLevels].SetActive(true); player = spawnedlevels[comletedLevels].GetComponent <MazePlayer>(); }