private void SetUpHUDAndScores() { if (PD.gameType == PersistData.GT.Challenge) { GameObject g = new GameObject("PuzzleHUD"); hud = g.AddComponent <PuzzleHUD>(); hud.Setup(1, PD.GetPuzzleLevel()); } else if (PD.gameType == PersistData.GT.Campaign) { GameObject g = new GameObject("CampaignHUD"); hud = g.AddComponent <CampaignHUD>(); hud.Setup(1); } else { GameObject g = new GameObject("InGameHUD"); hud = g.AddComponent <InGameHUD>(); if (player2Human || (PD.isDemo && PD.demoPlayers == 2)) { hud.Setup(2); } else if (PD.isTutorial) { hud.Setup(1, 1); tutorialAssist = hud.tutorialAssist; tutorialAssist.SetBoards(board1, board2); tutorialAssist.MoveHighlightToPosition(board1.GetScreenPosFromXY(4, 5)); } else { hud.Setup(1); } } if (PD.runningScore > 0) { board1.AddToScore(PD.runningScore); } if (PD.runningTime > 0) { hud.SetTimeWithSeconds(PD.runningTime); } }
protected virtual void DoTheActualSetup() { StateControllerInit(false); usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1; firstLaunch = true; player1Human = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus); bh = new BlockHandler(PD, PD.GetPuzzleLevel()); zaps = new List <ZappyGun>(); zapsToDelete = new List <ZappyGun>(); SetupCountdown(); SetupActors(); SetupRoundDisplay(); SetupEasterEgg(); specialMode = PD.useSpecial; height = PD.isTutorial?6:PD.rowCount; width = 8; float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f; CreateBoards(p1Xoffset, p2Xoffset); SetUpHUDAndScores(); if (PD.runningScore > 0) { board1.AddToScore(PD.runningScore); } if (PD.runningTime > 0) { hud.SetTimeWithSeconds(PD.runningTime); } if (PD.gameType == PersistData.GT.Challenge) { (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow(); } cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2); cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P); board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls); board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2)); board1.RefreshGraphics(); board2.RefreshGraphics(); CreateMirrors(p1Xoffset, p2Xoffset); mirror1.RefreshGraphics(); mirror2.RefreshGraphics(); SetupMouseControls(p1Xoffset); if (!PD.isDemo) { if (PD.gameType == PersistData.GT.Campaign) { campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign, mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead()); } pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons); pauseButton = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD"); pauseButton.SetActive(PD.usingMouse); pauseButton.transform.localScale = new Vector3(0.75f, 0.75f); FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f; pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject; pauseText.SetActive(PD.usingMouse); pauseTimer = 0; mouseObjects.Add(pauseButton); mouseObjects.Add(pauseText); } else { demoCountdown = 1800; } }