private void AddDamageReferenceKey() { Vector2 pos = new Vector2(PD.IsLeftAlignedHUD()?-0.9f:0.9f, 0.0f); GameObject helper = GetGameObject(pos, "Damage Reference", Resources.Load <Sprite>(SpritePaths.GuideCircle + (PD.IsColorBlind()?SpritePaths.ColorblindSuffix:"")), false, "Reference"); helper.transform.localScale = new Vector2(0.8f, 0.8f); }
private void FinishSetup(int seed) { bh = new BlockHandler(PD, PD.GetPuzzleLevel(), true, seed); float p1Xoffset = (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f; CreateBoards(p1Xoffset, p2Xoffset); cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2); cursor2 = CreatePlayerCursor(false, p2Xoffset, 2, board2, board1, PD.override2P); if (PD.isOnlineHost) { board1.Setup(cursor1, th, bh, new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), false, true, player1Human && usingTouchControls); board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, false); } else { board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, false); board1.Setup(cursor1, th, bh, new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), false, true, player1Human && usingTouchControls); } board1.RefreshGraphics(); board2.RefreshGraphics(); if (PD.runningScore > 0) { board1.AddToScore(PD.runningScore); } if (PD.runningTime > 0) { hud.SetTimeWithSeconds(PD.runningTime); } CreateMirrors(p1Xoffset, p2Xoffset); mirror1.RefreshGraphics(); mirror2.RefreshGraphics(); SetupMouseControls(p1Xoffset); }
override protected void AdditionalSetup(Sprite tile, int players, Vector3 offset, System.Xml.XmlNode top, int additionalInfo) { GetPersistData(); SetupFromPuzzleLevel(additionalInfo); float x = PD.IsLeftAlignedHUD() ? -1.2f : 0.6f; Vector3 pos = new Vector3(x, 1.03f); AddDamageReferenceKey(); FontData f = new FontData(TextAnchor.MiddleLeft, TextAlignment.Left, 0.03f); switch (puzzleType) { case 0: GetMeshText(pos, GetXmlValue(top, "lockedrow"), f); AddRowLocks(); break; case 1: GetMeshText(pos, GetXmlValue(top, "rotations"), f); break; case 2: GetMeshText(pos, GetXmlValue(top, "launches"), f); break; } remainingText = GetMeshText(new Vector3(x + 0.6f, 0.84f), initRemainingMoves.ToString(), new FontData(TextAnchor.MiddleRight, TextAlignment.Right, 0.045f)); }
private void AddDamageReferenceKey(int numPlayers) { Vector2 pos = (numPlayers == 2)?new Vector2(0.0f, 0.35f):new Vector2(PD.IsLeftAlignedHUD()?-0.9f:0.9f, 0.7f); GameObject helper = GetGameObject(pos, "Damage Reference", Resources.Load <Sprite>(SpritePaths.GuideCircle + (PD.IsColorBlind()?SpritePaths.ColorblindSuffix:"")), false, "Reference"); if (numPlayers == 2) { helper.transform.localScale = new Vector2(0.75f, 0.75f); } }
override protected void AdditionalSetup(Sprite tile, int players, Vector3 offset, System.Xml.XmlNode top, int additionalInfo) { money = 0; hudBox.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite> (SpritePaths.InfoBoxCampaign); float x = PD.IsLeftAlignedHUD() ? -1.2f : 0.6f; GetMeshText(new Vector3(x, 1.03f), GetXmlValue(top, "money"), new FontData(TextAnchor.MiddleLeft, TextAlignment.Left, 0.03f)); moneyText = GetMeshText(new Vector3(x + 0.6f, 0.84f), money.ToString(), new FontData(TextAnchor.MiddleRight, TextAlignment.Right, 0.045f)); shopText = GetMeshText(new Vector3(x + 0.3f, 0.5f), "", new FontData(TextAnchor.MiddleCenter, TextAlignment.Center, 0.023f)); AddDamageReferenceKey(); repairText = GetGameObject(new Vector3(2.4f, -0.65f), "repairs text", Resources.Load <Sprite>(SpritePaths.RepairText), false, "HUDText"); repairText.SetActive(false); }
private void AddRowLocks() { Sprite rowLockSprite = Resources.Load <Sprite>(SpritePaths.LockedRow); int actualUnlockedRow = PD.rowCount - initRemainingMoves; for (int y = 0; y < PD.rowCount; y++) { if (actualUnlockedRow == y) { continue; } GetGameObject(new Vector3((PD.IsLeftAlignedHUD()?0.45f:-0.45f), -1.84f + y * Consts.TILE_SIZE), "lock" + y, rowLockSprite, false, "Zapper"); } }
private void SetupRoundDisplay() { roundLabels = new List <GameObject>(); if (PD.rounds == 1) { return; } Sprite[] roundSheet = Resources.LoadAll <Sprite>(SpritePaths.RoundStateIcons); if (player2Human) { GenerateRoundDisplayColumn(roundSheet, -0.4f, 1.7f); GenerateRoundDisplayColumn(roundSheet, 0.4f, 1.7f, false); } else { GenerateRoundDisplayColumn(roundSheet, PD.IsLeftAlignedHUD() ? -1.3f : 1.3f, 1.85f); } }
public void Setup(int players, int additionalInfo = 0) { GetPersistData(); lastCheck = 0.0f; minutes = 0; seconds = 0; p1Score_val = 0; pausing = false; gameEnd = false; lose = false; XmlNode top = GetXMLHead(); Vector3 timerPos, p1ScorePos, p1NextPos; if (players == 1) { float x = PD.IsLeftAlignedHUD() ? -0.9f : 0.9f; timerPos = new Vector3(x, 1.1f); p1ScorePos = new Vector3(x - 0.3f, 1.4f); p1NextPos = new Vector3(x, -1.1f); } else { timerPos = new Vector3(0.0f, 1.0f); p1ScorePos = new Vector3(-0.3f, 1.3f); p1NextPos = new Vector3(0.0f, -1.1f); } Sprite infoBoxSprite = Resources.Load <Sprite> (SpritePaths.InfoBox); hudBox = GetGameObject(timerPos, "Time Box", infoBoxSprite, false, "HUD"); FontData f = new FontData(TextAnchor.MiddleLeft, TextAlignment.Left, 0.03f), f2 = new FontData(TextAnchor.MiddleRight, TextAlignment.Right, 0.045f); GetMeshText(timerPos + new Vector3(-0.3f, 0.67f), GetXmlValue(top, "time"), f); timerText = GetMeshText(timerPos + new Vector3(0.3f, 0.5f), "0:00", f2); GetMeshText(p1ScorePos, GetXmlValue(top, players == 1?"score":"p1score"), f); p1ScoreText = GetMeshText(timerPos + new Vector3(0.3f, 0.13f), PD.runningScore.ToString(), f2); UpdateTextValueAndSize(p1ScoreText, PD.runningScore); p1Next_box = GetGameObject(p1NextPos, "Next 1 Box", Resources.Load <Sprite> (SpritePaths.InfoBox), false, "HUD"); GetMeshText(p1NextPos + new Vector3(-0.3f, 0.67f), GetXmlValue(top, "next"), f); Vector3 offset = new Vector3(players == 2?-0.15f:-0.45f, -0.05f); AdditionalSetup(infoBoxSprite, players, offset, top, additionalInfo); }
public void Start() { 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.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; } }
virtual public void Setup(BoardCursorActualCore c, TweenHandler t, BlockHandler bh, Vector2 nexterPos, bool smallNext, bool show = true, bool touch = false) { GetPersistData(); usingTouchControls = touch; topoffset = 1; shiftall = false; dead = false; cursor = c; deathTile = 3; isShown = show; th = t; launchInfo = new LaunchInfo(-1, 0, deathTile, 0, 1.0f, false); countdownFromLaunch = 0; actionDelay = 0; changes = new List <MirrorChange>(); keyStates = new int[4] { -1, -1, -1, -1 }; tileSheet = GetTileSheet(); shapeSheet = GetShapeSheet(); overlaySprite = GetOverlaySprite(); bn = ScriptableObject.CreateInstance <BlockNexter>(); if (isShown) { bn.SetupUniversalPrefabAndSheet(PD.universalPrefab, tileSheet, overlaySprite); } bn.Initialize(bh, nexterPos.x, nexterPos.y, player, isShown, smallNext, ((smallNext || !PD.IsLeftAlignedHUD()) && player == 1) ? 1 : -1); SetupTilesList(); bn.SetupTileGraphics(); CreateBG(); chain = 0; misses = 0; }