void OnGUI() { if (!endStarted && !endBeforeFinish) { //bomb //if (TimerCoolDown >= 10.0f) { if (GUI.Button(new Rect(offsetx, offset + bombNormal.height / scalerY * 0, bombNormal.width / scalerX, bombNormal.height / scalerY), " ", bombStyle)) { if (totalPoints >= bombCost) { Vector2 tempPos = new Vector2((int)Mathf.Round(_player.transform.position.x), (int)Mathf.Round(_player.transform.position.y)); if (tempPos.y > 6) { Bomb(tempPos); sounds.playSound(0); } } } //} //bomb upgrade if (GUI.Button(new Rect(offsetx, offset + bombNormal.height / scalerY * 1, bombUpgradeNormal.width / scalerX, bombUpgradeNormal.height / scalerY), " ", bombUpgradeStyle)) { if (totalPoints >= bombUpgradeCost) { if (bombRange < maxBombRange) { bombRange++; IncreasePoints(-bombUpgradeCost, _player.transform.position); } } } //fuel if (GUI.Button(new Rect(offsetx, offset + bombNormal.height / scalerY * 2, FuelNormal.width / scalerX, FuelNormal.height / scalerY), " ", fuelStyle)) { if (totalPoints >= fuelCost) { _player.GetComponent <PlayerController>().refuel(100); fuelStyle.normal.background = FuelNormal; IncreasePoints(-fuelCost, _player.transform.position); } } //bonus points if (GUI.Button(new Rect(offsetx, offset + bombNormal.height / scalerY * 3, bonusNormal.width / scalerX, bonusNormal.height / scalerY), " ", bonusStyle)) { if (totalPoints >= bonusCost) { if (multiplierTimer == 0) { scoreMultiplier = 2; multiplierTimer = 10; IncreasePoints(-bonusCost, _player.transform.position); } } } //fuel flickering if (PlayerContl.getFuel() < 20) { fuelTimer -= 20 * Time.deltaTime; if (fuelTimer >= 30) { fuelStyle.normal.background = FuelNormal; } else { fuelStyle.normal.background = FuelRed; } if (fuelTimer <= 0) { fuelTimer = 60; } } GUI.DrawTexture(new Rect(0, 123, buttonHolder.width, buttonHolder.height), buttonHolder); } }
void OnGUI() { switch (tutState) { case "Idle": HideGuy(); break; case "Start": ShowGuy(0); GUI.DrawTexture(new Rect(Screen.width - 770, Screen.height - 510, 400, 300), TutBubble, ScaleMode.StretchToFill, true, 10.0f); if (tutStartState == 1) { GUI.Label(new Rect(Screen.width - 780, Screen.height - 560, 400, 300), startText1, Tutstyle); } if (tutStartState == 2) { GUI.Label(new Rect(Screen.width - 780, Screen.height - 560, 400, 300), startText2, Tutstyle); } if (tutStartState == 3) { GUI.Label(new Rect(Screen.width - 780, Screen.height - 560, 400, 300), startText3, Tutstyle); } if (tutStartState == 4) { GUI.Label(new Rect(Screen.width - 780, Screen.height - 560, 400, 300), startText4, Tutstyle); Rect rect = new Rect(Screen.width / 2 - 250, Screen.height / 2 + 100, 200, 200); Vector2 pivot = new Vector2(rect.xMin + rect.width * 0.5f, rect.yMin + rect.height * 0.5f); Matrix4x4 matrixBackup = GUI.matrix; GUIUtility.RotateAroundPivot(50, pivot); GUI.DrawTexture(rect, TutArrow); GUI.matrix = matrixBackup; } if (GUI.Button(new Rect(Screen.width - 450, Screen.height - 310, 100, 100), " ", NextStyle)) { tutStartState++; if (tutStartState == 5) { tutState = "Idle"; UnFreezeTime(); } sounds.playSound(1); } break; case "help1": ShowGuy(0); gManager.cam.disable(); GUI.DrawTexture(new Rect(Screen.width - 770, Screen.height - 510, 400, 300), TutBubble, ScaleMode.StretchToFill, true, 10.0f); GUI.Label(new Rect(Screen.width - 770, Screen.height - 560, 400, 300), helpText1, Tutstyle); Rect rect2 = new Rect(Screen.width - 450, 150, 200, 200); Vector2 pivot2 = new Vector2(rect2.xMin + rect2.width * 0.5f, rect2.yMin + rect2.height * 0.5f); Matrix4x4 matrixBackup2 = GUI.matrix; GUIUtility.RotateAroundPivot(-50, pivot2); GUI.DrawTexture(rect2, TutArrow); GUI.matrix = matrixBackup2; if (GUI.Button(new Rect(Screen.width - 450, Screen.height - 310, 100, 100), " ", NextStyle)) { tutState = "Idle"; gManager.cam.enable(); UnFreezeTime(); } break; case "help2": ShowGuy(1); gManager.cam.disable(); GUI.DrawTexture(new Rect(Screen.width - 770, Screen.height - 510, 400, 300), TutBubble, ScaleMode.StretchToFill, true, 10.0f); GUI.Label(new Rect(Screen.width - 770, Screen.height - 560, 400, 300), helpText2, Tutstyle); if (GUI.Button(new Rect(Screen.width - 450, Screen.height - 310, 100, 100), " ", NextStyle)) { tutState = "Idle"; gManager.cam.enable(); UnFreezeTime(); } break; case "help3": ShowGuy(1); gManager.cam.disable(); GUI.DrawTexture(new Rect(Screen.width - 770, Screen.height - 510, 400, 300), TutBubble, ScaleMode.StretchToFill, true, 10.0f); GUI.Label(new Rect(Screen.width - 770, Screen.height - 560, 400, 300), helpText3, Tutstyle); Rect rect3 = new Rect(150, Screen.height / 2 - 125, 200, 200); Vector2 pivot3 = new Vector2(rect3.xMin + rect3.width * 0.5f, rect3.yMin + rect3.height * 0.5f); Matrix4x4 matrixBackup3 = GUI.matrix; GUIUtility.RotateAroundPivot(180, pivot3); GUI.DrawTexture(rect3, TutArrow); GUI.matrix = matrixBackup3; if (GUI.Button(new Rect(Screen.width - 450, Screen.height - 310, 100, 100), " ", NextStyle)) { tutState = "Idle"; gManager.cam.enable(); UnFreezeTime(); } break; case "help4": ShowGuy(0); gManager.cam.disable(); GUI.DrawTexture(new Rect(Screen.width - 770, Screen.height - 510, 400, 300), TutBubble, ScaleMode.StretchToFill, true, 10.0f); GUI.Label(new Rect(Screen.width - 770, Screen.height - 560, 400, 300), helpText4, Tutstyle); Rect rect4 = new Rect(150, Screen.height / 2 - 400, 200, 200); Vector2 pivot4 = new Vector2(rect4.xMin + rect4.width * 0.5f, rect4.yMin + rect4.height * 0.5f); Matrix4x4 matrixBackup4 = GUI.matrix; GUIUtility.RotateAroundPivot(180, pivot4); GUI.DrawTexture(rect4, TutArrow); GUI.matrix = matrixBackup4; if (GUI.Button(new Rect(Screen.width - 450, Screen.height - 310, 100, 100), " ", NextStyle)) { tutState = "Idle"; gManager.cam.enable(); UnFreezeTime(); } break; } }