public void PlayerTeleportOnImpactPortal(EdgeBoard temp) { FindObjectOfType <AudioManager>().Play("portal"); if (temp.gameObject.name == "TopPlatform") { bottomPortalPlatform.child_capsuleCollider2D.isTrigger = true; player.transform.position = new Vector2(bottomPortalPlatform.transform.position.x, bottomPortalPlatform.transform.position.y); rb_player.velocity = rb_player.velocity * -1; playerInBottomPortal = true; } if (temp.gameObject.name == "BottomPlatform") { topPortalPlatform.child_capsuleCollider2D.isTrigger = true; player.transform.position = new Vector2(topPortalPlatform.transform.position.x, topPortalPlatform.transform.position.y); rb_player.velocity = rb_player.velocity * -1; playerInTopPortal = true; } if (temp.gameObject.name == "LeftPlatform") { rightPortalPlatform.child_capsuleCollider2D.isTrigger = true; player.transform.position = new Vector2(rightPortalPlatform.transform.position.x, rightPortalPlatform.transform.position.y); rb_player.velocity = rb_player.velocity * -1; playerInRightPortal = true; } if (temp.gameObject.name == "RightPlatform") { leftPortalPlatform.child_capsuleCollider2D.isTrigger = true; player.transform.position = new Vector2(leftPortalPlatform.transform.position.x, leftPortalPlatform.transform.position.y); rb_player.velocity = rb_player.velocity * -1; playerInLeftPortal = true; } }
//////// HERE PLAYER ENDS TELEPORT //////// void OnTriggerExit2D(Collider2D collider) { if (collider.gameObject.name == "EdgeSpriteCollider") { EdgeBoard tempEdgeBoard = collider.transform.parent.gameObject.GetComponent <EdgeBoard>(); if (tempEdgeBoard.panelIsPortal) { if (bottomPortalPlatform != null) { bottomPortalPlatform.child_capsuleCollider2D.isTrigger = false; playerInBottomPortal = false; } if (topPortalPlatform != null) { topPortalPlatform.child_capsuleCollider2D.isTrigger = false; playerInTopPortal = false; } if (rightPortalPlatform != null) { rightPortalPlatform.child_capsuleCollider2D.isTrigger = false; playerInRightPortal = false; } if (leftPortalPlatform != null) { leftPortalPlatform.child_capsuleCollider2D.isTrigger = false; playerInLeftPortal = false; } } } }
//////// HERE PLAYER ENDS TELEPORT //////// void OnTriggerExit2D(Collider2D collider) { if (collider.gameObject.name == "EdgeSpriteCollider") { Player tempPlayer = FindObjectOfType <Player>(); EdgeBoard tempEdgeBoard = collider.transform.parent.gameObject.GetComponent <EdgeBoard>(); if (tempEdgeBoard.panelIsPortal) { if (tempPlayer.bottomPortalPlatform != null) { tempPlayer.bottomPortalPlatform.child_capsuleCollider2D.isTrigger = false; copyPlayerInBottomPortal = false; } if (tempPlayer.topPortalPlatform != null) { tempPlayer.topPortalPlatform.child_capsuleCollider2D.isTrigger = false; copyPlayerInTopPortal = false; } if (tempPlayer.rightPortalPlatform != null) { tempPlayer.rightPortalPlatform.child_capsuleCollider2D.isTrigger = false; copyPlayerInRightPortal = false; } if (tempPlayer.leftPortalPlatform != null) { tempPlayer.leftPortalPlatform.child_capsuleCollider2D.isTrigger = false; copyPlayerInLeftPortal = false; } } } }
//////////////////////////////////////////////////////////// ///////////////// BUBBLE HITS TELEPORT PANNEL ///////////////////////// public void BubbleTeleportOnImpactPortal(EdgeBoard temp) { FindObjectOfType <AudioManager>().Play("portal"); if (temp.gameObject.name == "TopPlatform") { playerRef.bottomPortalPlatform.child_capsuleCollider2D.isTrigger = true; this.transform.position = new Vector2(playerRef.bottomPortalPlatform.transform.position.x, playerRef.bottomPortalPlatform.transform.position.y); rb_bubble.velocity = rb_bubble.velocity * -1; bubbleInBottomPortal = true; } if (temp.gameObject.name == "BottomPlatform") { playerRef.topPortalPlatform.child_capsuleCollider2D.isTrigger = true; this.transform.position = new Vector2(playerRef.topPortalPlatform.transform.position.x, playerRef.topPortalPlatform.transform.position.y); rb_bubble.velocity = rb_bubble.velocity * -1; bubbleInTopPortal = true; } if (temp.gameObject.name == "LeftPlatform") { playerRef.rightPortalPlatform.child_capsuleCollider2D.isTrigger = true; this.transform.position = new Vector2(playerRef.rightPortalPlatform.transform.position.x, playerRef.rightPortalPlatform.transform.position.y); rb_bubble.velocity = rb_bubble.velocity * -1; bubbleInRightPortal = true; } if (temp.gameObject.name == "RightPlatform") { playerRef.leftPortalPlatform.child_capsuleCollider2D.isTrigger = true; this.transform.position = new Vector2(playerRef.leftPortalPlatform.transform.position.x, playerRef.leftPortalPlatform.transform.position.y); rb_bubble.velocity = rb_bubble.velocity * -1; bubbleInLeftPortal = true; } }
////////////////////////////////////////////////////////////////////////////////////////////////////////// void OnCollisionEnter2D(Collision2D collision2D) { if (collision2D.gameObject.transform.name == "EdgeSpriteCollider" && playerIsMoving && gmInst.gameIsStarts) { EdgeBoard temp = collision2D.gameObject.transform.parent.GetComponent <EdgeBoard>(); if (temp.negativePositiveChance < 2 && !temp.panelIsPortal && !temp.panelIsZero && go_frozen_shield_child.activeSelf == false) { //Debug.Log("COLLISION WITH POSITIVE EDGE"); GetImpactEffect(true, this.transform.position, temp.gameObject.name); FindObjectOfType <AudioManager>().Play("impact_UP"); playerBubbleSize = playerBubbleSize + temp.edgeArgument; tempBubbleNumber = temp.edgeArgument; go_player_BubbleSize.SetActive(false); // here we turn off player bubble size number timeNotActive = 0; GetScore(temp.edgeArgument, Color.green, " ", " +", "PlayerChangeArgument", collision2D.gameObject.transform.position, true); ScaleControll(playerBubbleSize); } if (temp.negativePositiveChance >= 2 && !temp.panelIsPortal && !temp.panelIsZero && go_frozen_shield_child.activeSelf == false) { //Debug.Log("COLLISION WITH NEGATIVE EDGE"); GetImpactEffect(false, this.transform.position, temp.gameObject.name); playerBubbleSize = playerBubbleSize - temp.edgeArgument; tempBubbleNumber = temp.edgeArgument; if (playerBubbleSize <= 0) { GetScore(1, Color.red, " Bubble", " -", "playerGetsScore", this.transform.position, false); } else { FindObjectOfType <AudioManager>().Play("impact_DOWN"); go_player_BubbleSize.SetActive(false); timeNotActive = 0; GetScore(temp.edgeArgument, Color.red, " ", " -", "PlayerChangeArgument", this.transform.position, true); } ScaleControll(playerBubbleSize); } if (temp.panelIsPortal) { PlayerTeleportOnImpactPortal(temp); } if (temp.panelIsZero) { playerBubbleSize = 0; GetScore(1, Color.red, " Bubble", " -", "playerGetsScore", this.transform.position, false); frozenDurability = 0; } if (go_frozen_shield_child.activeSelf == true) { FindObjectOfType <AudioManager>().Play("impact_W_ICE"); GetImpactEffect(false, this.transform.position, temp.gameObject.name); frozenDurability -= 1; } } }
public void SetUp() { _edgeBoard = new EdgeBoard(10, 10); cellArray = new Cell[3, 3]; // Initialise array... for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cellArray[i, j].alive = false; cellArray[i, j].row = i; cellArray[i, j].column = j; } } }
///// SPAWN BUBBLES AFTER PLAYERS TURN ////// public void ResetPlatformsAfterPlayerTurn() { gameManagerRef.chanceToHavePortalTopBottomPanel = Random.Range(0, 8); gameManagerRef.chanceToHavePortalLeftRightPanel = Random.Range(0, 4); gameManagerRef.chanceToHavePotralOnTurn = Random.Range(0, 11); gameManagerRef.chanceToHaveZero = Random.Range(0, 5); if (!gameManagerRef.playerTurn && gameManagerRef.playerRef.name == "player" && !gameManagerRef.deleteGame) { //Debug.Log("RESET PLATFORMS HERE"); ///BEFORE WE SAID WHICH SIDE OF TABLE WILL HAVE A PORTALS int RandomChanceToHaveAllPortals = Random.Range(0, 3); int RandomChanceToHaveZoroOnTopThisTurn = Random.Range(0, gameManagerRef.topPlatformsList.Count); int RandomChanceToHaveZoroOnBottomThisTurn = Random.Range(0, gameManagerRef.bottomPlatformsList.Count); int RandomChanceToHaveZoroOnRightThisTurn = Random.Range(0, gameManagerRef.rightPlatformsList.Count); int RandomChanceToHaveZoroOnLeftThisTurn = Random.Range(0, gameManagerRef.leftPlatformsList.Count); //Debug.Log("RESET PLATFORMS"); ///////////// HERE WE CHANGE ARGUMENT ON EACH PLATFORM ///////////////// for (int i = 0; i < gameManagerRef.topPlatformsList.Count; i++) { EdgeBoard temp = gameManagerRef.topPlatformsList[i].GetComponent <EdgeBoard>(); temp.child_capsuleCollider2D.isTrigger = false; temp.panelIsPortal = false; temp.panelIsZero = false; if (i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 0 || i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 2 ) { temp.panelIsPortal = true; } if (gameManagerRef.chanceToHaveZero == 0 && !temp.panelIsPortal && i == RandomChanceToHaveZoroOnTopThisTurn) { temp.panelIsZero = true; } temp.TakeNewArgument(); } for (int i = 0; i < gameManagerRef.bottomPlatformsList.Count; i++) { EdgeBoard temp = gameManagerRef.bottomPlatformsList[i].GetComponent <EdgeBoard>(); temp.child_capsuleCollider2D.isTrigger = false; temp.panelIsPortal = false; temp.panelIsZero = false; if (i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 0 || i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 2 ) { temp.panelIsPortal = true; } if (gameManagerRef.chanceToHaveZero == 1 && !temp.panelIsPortal && i == RandomChanceToHaveZoroOnBottomThisTurn) { temp.panelIsZero = true; } temp.TakeNewArgument(); } for (int i = 0; i < gameManagerRef.rightPlatformsList.Count; i++) { EdgeBoard temp = gameManagerRef.rightPlatformsList[i].GetComponent <EdgeBoard>(); temp.child_capsuleCollider2D.isTrigger = false; temp.panelIsPortal = false; temp.panelIsZero = false; if (i == gameManagerRef.chanceToHavePortalLeftRightPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 1 || i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 2 ) { temp.panelIsPortal = true; } if (gameManagerRef.chanceToHaveZero == 2 && !temp.panelIsPortal && i == RandomChanceToHaveZoroOnRightThisTurn) { temp.panelIsZero = true; } temp.TakeNewArgument(); } for (int i = 0; i < gameManagerRef.leftPlatformsList.Count; i++) { EdgeBoard temp = gameManagerRef.leftPlatformsList[i].GetComponent <EdgeBoard>(); temp.child_capsuleCollider2D.isTrigger = false; temp.panelIsPortal = false; temp.panelIsZero = false; if (i == gameManagerRef.chanceToHavePortalLeftRightPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 1 || i == gameManagerRef.chanceToHavePortalTopBottomPanel && gameManagerRef.chanceToHavePotralOnTurn > 5 && RandomChanceToHaveAllPortals == 2 ) { temp.panelIsPortal = true; } if (gameManagerRef.chanceToHaveZero == 3 && !temp.panelIsPortal && i == RandomChanceToHaveZoroOnLeftThisTurn) { temp.panelIsZero = true; } temp.TakeNewArgument(); } ///////////////////////////////////////////////////////////////////////// gameManagerRef.playerRef.name = "player_idle"; Invoke("ResetPlayerTurnLabelText", 1f); } }
///// SET TIMER FOR BOARD EDGES ON DESTROY ////// void DestroyTableEdges() { //Calling TOP platroms and ading them into top list for (int i = 0; i < topPlatformsList.Count; i++) { EdgeBoard tempDestroy = topPlatformsList[i].GetComponent <EdgeBoard>(); if (i == 0) { tempDestroy.timerDestroy = 1 + i; } if (i == 1) { tempDestroy.timerDestroy = 1 + i; } if (i == 2) { tempDestroy.timerDestroy = 1 + i; } if (i == 3) { tempDestroy.timerDestroy = 1 + i; } if (i == 4) { tempDestroy.timerDestroy = 1 + i; } if (i == 5) { tempDestroy.timerDestroy = 1 + i; } if (i == 6) { tempDestroy.timerDestroy = 1 + i; } if (i == 7) { tempDestroy.timerDestroy = 1 + i; } if (i == 8) { tempDestroy.timerDestroy = 1 + i; } if (i == 9) { tempDestroy.timerDestroy = 1 + i; } } //Calling RIGHT platforms and ading them into bottom list for (int i = 0; i < rightPlatformsList.Count; i++) { EdgeBoard tempDestroy = rightPlatformsList[i].GetComponent <EdgeBoard>(); if (i == 0) { tempDestroy.timerDestroy = 16 + i; } if (i == 1) { tempDestroy.timerDestroy = 14 + i; } if (i == 2) { tempDestroy.timerDestroy = 12 + i; } if (i == 3) { tempDestroy.timerDestroy = 10 + i; } if (i == 4) { tempDestroy.timerDestroy = 8 + i; } if (i == 5) { tempDestroy.timerDestroy = 6 + i; } } //Calling BOTTOM platforms and ading them into bottom list for (int i = 0; i < bottomPlatformsList.Count; i++) { EdgeBoard tempDestroy = bottomPlatformsList[i].GetComponent <EdgeBoard>(); if (i == 0) { tempDestroy.timerDestroy = 26 + i; } if (i == 1) { tempDestroy.timerDestroy = 24 + i; } if (i == 2) { tempDestroy.timerDestroy = 22 + i; } if (i == 3) { tempDestroy.timerDestroy = 20 + i; } if (i == 4) { tempDestroy.timerDestroy = 18 + i; } if (i == 5) { tempDestroy.timerDestroy = 16 + i; } if (i == 6) { tempDestroy.timerDestroy = 14 + i; } if (i == 7) { tempDestroy.timerDestroy = 12 + i; } if (i == 8) { tempDestroy.timerDestroy = 10 + i; } if (i == 9) { tempDestroy.timerDestroy = 8 + i; } } //Calling LEFT platforms and ading them into bottom list for (int i = 0; i < leftPlatformsList.Count; i++) { EdgeBoard tempDestroy = leftPlatformsList[i].GetComponent <EdgeBoard>(); if (i == 0) { tempDestroy.timerDestroy = 28 + i; } if (i == 1) { tempDestroy.timerDestroy = 28 + i; } if (i == 2) { tempDestroy.timerDestroy = 28 + i; } if (i == 3) { tempDestroy.timerDestroy = 28 + i; } if (i == 4) { tempDestroy.timerDestroy = 28 + i; } if (i == 5) { tempDestroy.timerDestroy = 28 + i; } } }
//////// INSTANTIATIONS START NEW GAME //////// public void GameStateInstantiation() { //Time.timeScale = 1; gameManager = this; // Inst of GameManager Instantiate(playerPrefab); // Inst main player stateManagerRef = GameObject.Find("GameStateManager").GetComponent <GameStateManager>(); helperRef = gameObject.GetComponent <Helper>(); mainCamera = Camera.main; mainCanvas = GameObject.Find("Canvas").GetComponent <Canvas>(); mainCanvas.record = PlayerPrefs.GetInt("HighScore"); go_Effects_Container = GameObject.Find("LootContainer"); // assign REF for LootContainer //Finding all game objects here go_Pool_Container = GameObject.Find("PoolContainer"); go_TopPlatforms_Container = GameObject.Find("TopPlatformContainer"); go_BottonPlatforms_Container = GameObject.Find("BottomPlatformContainer"); go_LeftPlatforms_Container = GameObject.Find("LeftPlatformContainer"); go_RightPlatforms_Container = GameObject.Find("RightPlatformContainer"); chanceToHavePortalTopBottomPanel = Random.Range(0, 8); chanceToHavePortalLeftRightPanel = Random.Range(0, 4); chanceToHavePotralOnTurn = Random.Range(0, 11); helperRef.SetScreenEdges(); touchEvent = false; gameIsStarts = false; playerLostBubbleGM = false; deleteGame = false; GameIsOver = false; faqActive = false; creditsActive = false; // finding and applying animation controllers for (int i = 0; i < bubblesController.Length; i++) { if (i == 0) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("blue_controller"); } if (i == 1) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("green_controller"); } if (i == 2) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("pink_controller"); } if (i == 3) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("purple_controller"); } if (i == 4) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("red_controller"); } if (i == 5) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("white_controller"); } if (i == 6) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("yellow_controller"); } if (i == 7) { bubblesController[i] = (RuntimeAnimatorController)Resources.Load("player_controller"); } } // Instantiation of the explosion for (int i = 0; i < 5; i++) { GameObject tempExplosion = Instantiate(explosionPrefab); tempExplosion.transform.parent = go_Effects_Container.transform; effects.Add(tempExplosion); } // Instatntiation of the explosion with Poison for (int i = 0; i < 5; i++) { GameObject tempExplosionPoison = Instantiate(explosion_poisonPrefab); tempExplosionPoison.transform.parent = go_Effects_Container.transform; effects.Add(tempExplosionPoison); } //Here we can change quantaty of the bubbles for spawn ----> for (int i = 0; i < 10; i++) { GameObject tempBubble = Instantiate(bubblePrefab); bubbles.Add(tempBubble); } //SET SPECIFIC NUMBER FOR EACH BUBBLE IN THE LIST for (int i = 0; i < bubbles.Count; i++) { Bubble tempBubble = bubbles[i].GetComponent <Bubble>(); tempBubble.NUMBER_in_the_list = i; } //Here we can change quantaty of the impact_RED for spawn ----> for (int i = 0; i < 25; i++) { GameObject tempBubble = Instantiate(impact_Prefab); tempBubble.name = "impact_RED"; //effects.Add(tempBubble); } for (int i = 0; i < 25; i++) { GameObject tempBubble = Instantiate(impact_Prefab); tempBubble.name = "impact_GREEN"; //impacts.Add(tempBubble); } //Creating list of the objects which hold BUBBLE_ENDS OBJECTS ----> for (int i = 0; i < 100; i++) { GameObject tempBubble = Instantiate(bubbleEndPrefab); tempBubble.SetActive(false); tempBubble.name = "bubbleEnd_" + i; tempBubble.transform.parent = go_Pool_Container.transform; tempBubble.transform.position = go_Pool_Container.transform.position; bubblesEnd.Add(tempBubble); } //Creating list of the objects which hold SCORES OBJECTS ----> for (int i = 0; i < 100; i++) { GameObject tempObj = Instantiate(score_Prefab); tempObj.SetActive(false); score.Add(tempObj); score[i].transform.parent = go_Pool_Container.transform; score[i].transform.position = go_Pool_Container.transform.position; score[i].name = "score_NoName"; } /////////////////////////////// HERE WE ADD EDGE PLATFORMS IN THE GAME /////////////////////////// #region START FOR All TABLE EGES IS HERE //Calling TOP platroms and ading them into top list for (int i = 0; i < 10; i++) { GameObject tempObj = Instantiate(platformEdgePrefab); GameObject tempChild = tempObj.transform.GetChild(0).gameObject; //Debug.Log(tempChild.name); topPlatformsList.Add(tempObj); topPlatformsList[i].transform.parent = go_TopPlatforms_Container.transform; EdgeBoard tempAwaiking = tempObj.GetComponent <EdgeBoard>(); if (i == chanceToHavePortalTopBottomPanel && chanceToHavePotralOnTurn > 5) { tempAwaiking.panelIsPortal = true; } if (i == 0) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i + 1 * 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 1) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 4, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 2) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 3) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 4) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 5) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 6) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 7) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 8) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } if (i == 9) { topPlatformsList[i].transform.position = new Vector3(go_TopPlatforms_Container.transform.position.x + i * 2 + 2, go_TopPlatforms_Container.transform.position.y, go_TopPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 1 + (float)i; tempAwaiking.timerAwakingInMemory = 1 + (float)i; tempAwaiking.numberInList = i; } topPlatformsList[i].name = "TopPlatform"; tempObj.transform.rotation = new Quaternion(0, 0, 0, 0); } //Calling RIGHT platforms and ading them into bottom list for (int i = 0; i < 6; i++) { GameObject tempObj = Instantiate(platformEdgePrefab); GameObject tempChild = tempObj.transform.GetChild(0).gameObject; rightPlatformsList.Add(tempObj); rightPlatformsList[i].transform.parent = go_RightPlatforms_Container.transform; EdgeBoard tempAwaiking = tempObj.GetComponent <EdgeBoard>(); if (i == chanceToHavePortalLeftRightPanel && chanceToHavePotralOnTurn > 5) { tempAwaiking.panelIsPortal = true; } if (i == 0) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 0.5f * 2, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 16 + (float)i; tempAwaiking.timerAwakingInMemory = 16 + (float)i; tempAwaiking.numberInList = i; } if (i == 1) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 1 * 2, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 14 + (float)i; tempAwaiking.timerAwakingInMemory = 14 + (float)i; tempAwaiking.numberInList = i; } if (i == 2) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 3, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 12 + (float)i; tempAwaiking.timerAwakingInMemory = 12 + (float)i; tempAwaiking.numberInList = i; } if (i == 3) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 4, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 10 + (float)i; tempAwaiking.timerAwakingInMemory = 10 + (float)i; tempAwaiking.numberInList = i; } if (i == 4) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 5, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 8 + (float)i; tempAwaiking.timerAwakingInMemory = 8 + (float)i; tempAwaiking.numberInList = i; } if (i == 5) { rightPlatformsList[i].transform.position = new Vector3(go_RightPlatforms_Container.transform.position.x - 0.75f, go_RightPlatforms_Container.transform.position.y + i + 6, go_RightPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 6 + (float)i; tempAwaiking.timerAwakingInMemory = 6 + (float)i; tempAwaiking.numberInList = i; } rightPlatformsList[i].name = "RightPlatform"; tempObj.transform.rotation = new Quaternion(0, 0, -90, 90); tempChild.transform.rotation = new Quaternion(0, 0, 0, 180); } //Calling BOTTOM platforms and ading them into bottom list for (int i = 0; i < 10; i++) { GameObject tempObj = Instantiate(platformEdgePrefab); GameObject tempChild = tempObj.transform.GetChild(0).gameObject; bottomPlatformsList.Add(tempObj); bottomPlatformsList[i].transform.parent = go_BottonPlatforms_Container.transform; EdgeBoard tempAwaiking = tempObj.GetComponent <EdgeBoard>(); if (i == chanceToHavePortalTopBottomPanel && chanceToHavePotralOnTurn > 5) { tempAwaiking.panelIsPortal = true; } if (i == 0) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i + 1 * 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 26 + (float)i; tempAwaiking.timerAwakingInMemory = 26 + (float)i; tempAwaiking.numberInList = i; } if (i == 1) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 4, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 24 + (float)i; tempAwaiking.timerAwakingInMemory = 24 + (float)i; tempAwaiking.numberInList = i; } if (i == 2) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 22 + (float)i; tempAwaiking.timerAwakingInMemory = 22 + (float)i; tempAwaiking.numberInList = i; } if (i == 3) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 20 + (float)i; tempAwaiking.timerAwakingInMemory = 20 + (float)i; tempAwaiking.numberInList = i; } if (i == 4) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 18 + (float)i; tempAwaiking.timerAwakingInMemory = 18 + (float)i; tempAwaiking.numberInList = i; } if (i == 5) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 16 + (float)i; tempAwaiking.timerAwakingInMemory = 16 + (float)i; tempAwaiking.numberInList = i; } if (i == 6) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 14 + (float)i; tempAwaiking.timerAwakingInMemory = 14 + (float)i; tempAwaiking.numberInList = i; } if (i == 7) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 12 + (float)i; tempAwaiking.timerAwakingInMemory = 12 + (float)i; tempAwaiking.numberInList = i; } if (i == 8) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 10 + (float)i; tempAwaiking.timerAwakingInMemory = 10 + (float)i; tempAwaiking.numberInList = i; } if (i == 9) { bottomPlatformsList[i].transform.position = new Vector3(go_BottonPlatforms_Container.transform.position.x + i * 2 + 2, go_BottonPlatforms_Container.transform.position.y, go_BottonPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 8 + (float)i; tempAwaiking.timerAwakingInMemory = 8 + (float)i; tempAwaiking.numberInList = i; } bottomPlatformsList[i].name = "BottomPlatform"; tempObj.transform.rotation = new Quaternion(0, 0, 180, 0); tempChild.transform.rotation = new Quaternion(0, 0, 0, 180); } //Calling LEFT platforms and ading them into bottom list for (int i = 0; i < 6; i++) { GameObject tempObj = Instantiate(platformEdgePrefab); GameObject tempChild = tempObj.transform.GetChild(0).gameObject; leftPlatformsList.Add(tempObj); leftPlatformsList[i].transform.parent = go_LeftPlatforms_Container.transform; EdgeBoard tempAwaiking = tempObj.GetComponent <EdgeBoard>(); if (i == chanceToHavePortalLeftRightPanel && chanceToHavePotralOnTurn > 5) { tempAwaiking.panelIsPortal = true; } if (i == 0) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 0.5f * 2, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } if (i == 1) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 1 * 2, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } if (i == 2) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 3, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } if (i == 3) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 4, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } if (i == 4) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 5, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } if (i == 5) { leftPlatformsList[i].transform.position = new Vector3(go_LeftPlatforms_Container.transform.position.x + 0.75f, go_LeftPlatforms_Container.transform.position.y + i + 6, go_LeftPlatforms_Container.transform.position.z); tempAwaiking.timerAwaking = 28 + (float)i; tempAwaiking.timerAwakingInMemory = 28 + (float)i; tempAwaiking.numberInList = i; } leftPlatformsList[i].name = "LeftPlatform"; tempObj.transform.rotation = new Quaternion(0, 0, -180, -180); tempChild.transform.rotation = new Quaternion(0, 0, 0, 180); } #endregion ////////////////////////////////////////////////////////////////////////////////////////////////// ApplySetUpForFirstBubbles(); // Here we assign timer awaking for enemies bubbles ------> }
/////////////////////////////////////////////// void OnCollisionEnter2D(Collision2D collision2D) { if (collision2D.gameObject.transform.name == "PlayerCopy_Effect_0" || collision2D.gameObject.transform.name == "PlayerCopy_Effect_1" || collision2D.gameObject.transform.name == "PlayerCopy_Effect_2") { PlayerCopy tempPlayerCopy = collision2D.gameObject.GetComponent <PlayerCopy>(); int storeColliderCopyPlayerBubbleSize = tempPlayerCopy.playerCopyBubbleSize; this.playerCopyBubbleSize += storeColliderCopyPlayerBubbleSize; impact_UP.mute = false; impact_UP.Play(); this. go_playerCopy_BubbleSize.SetActive(false); timeNotActive = 0; GetScore(storeColliderCopyPlayerBubbleSize, Color.green, " ", " +", name + "_ChangeArgument", this.transform.position, true); ScaleControll(playerCopyBubbleSize); } if (collision2D.gameObject.transform.name == "EdgeSpriteCollider") { EdgeBoard temp = collision2D.gameObject.transform.parent.GetComponent <EdgeBoard>(); if (temp.negativePositiveChance < 2 && !temp.panelIsPortal && !temp.panelIsZero) { //Debug.Log("COLLISION WITH POSITIVE EDGE"); impact_UP.mute = false; impact_UP.Play(); tempNumber = temp.edgeArgument; playerCopyBubbleSize += tempNumber; go_playerCopy_BubbleSize.SetActive(false); timeNotActive = 0; GetScore(tempNumber, Color.green, " ", " +", name + "_ChangeArgument", this.transform.position, true); ScaleControll(playerCopyBubbleSize); } if (temp.negativePositiveChance >= 2 && !temp.panelIsPortal && !temp.panelIsZero) { //Debug.Log("COLLISION WITH NEGATIVE EDGE") tempNumber = temp.edgeArgument; playerCopyBubbleSize -= tempNumber; if (playerCopyBubbleSize <= 0) { timer = 0; this.gameObject.SetActive(false); GetPlayerCopyBubbleEnd(); Invoke("DestroyPlayerCopy", 0.05f); } else { impact_DOWN.mute = false; impact_DOWN.Play(); this.go_playerCopy_BubbleSize.SetActive(false); this.timeNotActive = 0; GetScore(tempNumber, Color.red, " ", " -", name + "_ChangeArgument", this.transform.position, true); } ScaleControll(playerCopyBubbleSize); } if (temp.panelIsPortal && !temp.panelIsZero) { CopyPlayerTeleportOnImpactPortal(temp); } if (temp.panelIsZero && !temp.panelIsPortal) { timer = 0; this.gameObject.SetActive(false); GetPlayerCopyBubbleEnd(); Invoke("DestroyPlayerCopy", 0.05f); } } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void OnCollisionEnter2D(Collision2D collision) { //////// HERE IS COLLISION WITH PLAYER IF IT"S ACTIVE ///////// if (playerRef != null && this.gameObject.activeSelf == true) { if (collision.gameObject.name == "player" && gameManagerRef.gameIsStarts || collision.gameObject.name == "player_idle" && gameManagerRef.gameIsStarts) { int tempPlayerSize = playerRef.playerBubbleSize; // store temp Player's bubble size int tempThisSize = bubbleSize; // store temp Enemy bubble size bubbleSize -= tempPlayerSize; // here calculating enemy's bubble size storeBubbleSize = bubbleSize; storeBubbleSizeExplosion = bubbleSize; if (playerRef.frozenDurability > 0) { bubbleSize -= bubbleSize; FindObjectOfType <AudioManager>().Play("impact_W_ICE"); } //If Player has frozen bubble //if player has NO ANY shield if (playerRef.shieldDurability <= 0 && playerRef.frozenDurability <= 0) { playerRef.playerBubbleSize -= tempThisSize; // here calculating player's bubble argument after collision if (playerRef.playerBubbleSize <= 0) { playerRef.GetScore(1, Color.red, " Bubble", " -", "playerGetsScore", playerRef.transform.position, false); } if (playerRef.playerBubbleSize > 0) { //Debug.Log("PLAYER SHOULD SEE MINUS"); playerRef.go_player_BubbleSize.SetActive(false); playerRef.timeNotActive = 0; playerRef.GetScore(tempThisSize, Color.red, " ", " -", "PlayerChangeArgument", playerRef.transform.position, true); playerRef.ScaleControll(playerRef.playerBubbleSize); // set new scale for player ScaleControll(playerRef.playerBubbleSize); // Set new scale for player bubble } } /// CHECKING THIS BUBBLE STATUS AFTER COLLISION WITH PLAYER if (bubbleSize <= 0) { GetScore(tempThisSize, bubbleSizeOnText.color, " pts", " +", this.transform.position, false, "playerGetsScore", false); playerRef.playerScore += tempThisSize; playerRef.playerKills += 1; gameManagerRef.progressBar.f_fill -= (float)tempThisSize / 1000; GetBubbleEnd(); Invoke("DestroyBubble", 0.005f); } else { FindObjectOfType <AudioManager>().Play("impact_DOWN"); //GetScore(tempPlayerSize, Color.red," ", " -", this.transform.position, true, "changeArgument", true); GetScore(tempPlayerSize, Color.red, " ", " -", this.transform.position, true, "BubbleChangeArgument_" + NUMBER_in_the_list.ToString(), false); gameManagerRef.progressBar.f_fill -= (float)tempPlayerSize / 1000; this.bubbleScoreRenderer.enabled = false; this.timeNotActive = 0; ScaleControll(bubbleSize); } if (playerRef.shieldDurability > 0) { playerRef.shieldDurability -= 1; // decrease durability for player's shield ability //playerRef.GetScore(1, Color.red, " Shield", " -", "playerGetsScore", playerRef.transform.position, false); } if (playerRef.frozenDurability > 0) { playerRef.frozenDurability -= 1; // decrease durability for player's shield ability //playerRef.GetScore(1, Color.red, " Freeze", " -", "playerGetsScore", playerRef.transform.position, false); } } } //Checking collison with others bubbles if ((collision.gameObject.name == "blue" || collision.gameObject.name == "green" || collision.gameObject.name == "pink" || collision.gameObject.name == "red" || collision.gameObject.name == "purple" || collision.gameObject.name == "white" || collision.gameObject.name == "yellow") && !gameManagerRef.playerTurn && gameManagerRef.gameIsStarts || (collision.gameObject.name == "blue" || collision.gameObject.name == "green" || collision.gameObject.name == "pink" || collision.gameObject.name == "red" || collision.gameObject.name == "purple" || collision.gameObject.name == "white" || collision.gameObject.name == "yellow") && playerRef.gameObject.activeSelf == false && playerRef != null && !gameManagerRef.playerTurn && gameManagerRef.gameIsStarts || (collision.gameObject.name == "blue_idle" || collision.gameObject.name == "green_idle" || collision.gameObject.name == "pink_idle" || collision.gameObject.name == "red_idle" || collision.gameObject.name == "purple_idle" || collision.gameObject.name == "white_idle" || collision.gameObject.name == "yellow_idle") && !gameManagerRef.playerTurn && gameManagerRef.gameIsStarts || (collision.gameObject.name == "blue_idle" || collision.gameObject.name == "green_idle" || collision.gameObject.name == "pink_idle" || collision.gameObject.name == "red_idle" || collision.gameObject.name == "purple_idle" || collision.gameObject.name == "white_idle" || collision.gameObject.name == "yellow_idle") && playerRef.gameObject.activeSelf == false && playerRef != null && !gameManagerRef.playerTurn && gameManagerRef.gameIsStarts ) { Bubble collisionBubble = collision.gameObject.GetComponent <Bubble>(); this.bubbleScoreRenderer.enabled = false; this.timeNotActive = 0; gameManagerRef.helperRef.ControllOverBubbleCollideEachOther(collisionBubble, this); } if (collision.gameObject.name == "PlayerCopy_Effect_0" || collision.gameObject.name == "PlayerCopy_Effect_1" || collision.gameObject.name == "PlayerCopy_Effect_2") { PlayerCopy tempPlayerCopy = collision.gameObject.GetComponent <PlayerCopy>(); int tempCopyPlayerSize = tempPlayerCopy.playerCopyBubbleSize; // store temp player's Copy bubble size int tempThisSize = bubbleSize; // store temp Enemy bubble size bubbleSize -= tempCopyPlayerSize; // here calculating enemy's bubble size tempPlayerCopy.playerCopyBubbleSize -= Mathf.Abs(tempThisSize); // here calculating player's bubble argument after collision if (bubbleSize <= 0) { bubbleSize = 0; GetScore(tempThisSize, bubbleSizeOnText.color, " pts", " +", this.transform.position, false, "playerGetsScore", false); tempPlayerCopy.GetScore(Mathf.Abs(tempThisSize), Color.red, " ", " -", "BubbleChangeArgument_" + NUMBER_in_the_list.ToString(), tempPlayerCopy.transform.position, true); playerRef.playerScore += tempThisSize; playerRef.playerKills += 1; gameManagerRef.progressBar.f_fill -= (float)tempThisSize / 1000; GetBubbleEnd(); Invoke("DestroyBubble", 0.005f); } else { FindObjectOfType <AudioManager>().Play("impact_DOWN"); GetScore(Mathf.Abs(tempCopyPlayerSize), Color.red, " ", " -", this.transform.position, true, "BubbleChangeArgument_" + NUMBER_in_the_list.ToString(), false); gameManagerRef.progressBar.f_fill -= (float)tempCopyPlayerSize / 1000; this.bubbleScoreRenderer.enabled = false; this.timeNotActive = 0; storeBubbleSize = bubbleSize; storeBubbleSizeExplosion = bubbleSize; ScaleControll(bubbleSize); } if (tempPlayerCopy.playerCopyBubbleSize > 0) { tempPlayerCopy.go_playerCopy_BubbleSize.SetActive(false); tempPlayerCopy.timeNotActive = 0; tempPlayerCopy.GetScore(Mathf.Abs(tempThisSize), Color.red, " ", " -", tempPlayerCopy.name + "_ChangeArgument", tempPlayerCopy.transform.position, true); tempPlayerCopy.ScaleControll(tempPlayerCopy.playerCopyBubbleSize); // set new scale for player } } //Checking collision with platfomrs if (collision.gameObject.transform.name == "EdgeSpriteCollider" && bubbleIsMoving && playerRef.gameObject.activeSelf == true && playerRef != null && gameManagerRef.gameIsStarts || collision.gameObject.transform.name == "EdgeSpriteCollider" && bubbleIsMoving && playerRef.gameObject.activeSelf == false && playerRef != null && gameManagerRef.gameIsStarts) { EdgeBoard temp = collision.gameObject.transform.parent.GetComponent <EdgeBoard>(); int tempBubbleSize = bubbleSize; // here we store bubble size by using new variable storeBubbleSize = bubbleSize; storeBubbleSizeExplosion = bubbleSize; if (temp.negativePositiveChance < 2 && !temp.panelIsPortal && !temp.panelIsZero) { FindObjectOfType <AudioManager>().Play("impact_UP"); gameManagerRef.progressBar.f_fill += (float)temp.edgeArgument / 1000; //Here we need calculate number argument, make it bugger tempEdgeArgument = temp.edgeArgument; bubbleSize += tempEdgeArgument; storeBubbleSize = bubbleSize; storeBubbleSizeExplosion = bubbleSize; this.bubbleScoreRenderer.enabled = false; this.timeNotActive = 0; GetScore(tempEdgeArgument, Color.green, " ", " +", collision.transform.position, true, "BubbleChangeArgument_" + NUMBER_in_the_list.ToString(), false); ScaleControll(bubbleSize); // Set new scale for this bubble //Debug.Log("COLLISION WITH POSITIVE EDGE " + tempEdgeArgument); GetImpactEffect(true, this.transform.position, temp.gameObject.name); } if (temp.negativePositiveChance >= 2 && !temp.panelIsPortal && !temp.panelIsZero) { //Here we need calculate number, make it smaller tempEdgeArgument = temp.edgeArgument; bubbleSize -= tempEdgeArgument; if (bubbleSize <= 0) { bubbleSize = 0; GetScore(storeBubbleSize, bubbleSizeOnText.color, " pts", " +", this.transform.position, false, "playerGetsScore", false); playerRef.playerScore += storeBubbleSize; playerRef.playerKills += 1; gameManagerRef.progressBar.f_fill -= (float)storeBubbleSize / 1000; GetBubbleEnd(); Invoke("DestroyBubble", 0.005f); } else { FindObjectOfType <AudioManager>().Play("impact_DOWN"); GetScore(tempEdgeArgument, Color.red, " ", " -", collision.transform.position, true, "BubbleChangeArgument_" + NUMBER_in_the_list.ToString(), false); this.bubbleScoreRenderer.enabled = false; this.timeNotActive = 0; storeBubbleSize = bubbleSize; storeBubbleSizeExplosion = bubbleSize; gameManagerRef.progressBar.f_fill -= (float)tempEdgeArgument / 1000; ScaleControll(bubbleSize); // Set new scale for this bubble } GetImpactEffect(false, this.transform.position, temp.gameObject.name); } if (temp.panelIsPortal && rb_bubble.velocity.magnitude > 0.25f) { FindObjectOfType <AudioManager>().Play("portal"); BubbleTeleportOnImpactPortal(temp); } if (temp.panelIsZero) { bubbleSize = 0; GetScore(storeBubbleSize, bubbleSizeOnText.color, " pts", " +", this.transform.position, false, "playerGetsScore", false); playerRef.playerScore += storeBubbleSize; playerRef.playerKills += 1; gameManagerRef.progressBar.f_fill -= (float)storeBubbleSize / 1000; GetBubbleEnd(); Invoke("DestroyBubble", 0.005f); } } }