private void OnCollisionEnter2D(Collision2D collision) { mainManager.AddGameScore(numbersPoint[bumperCode]); effect.SetEffect(bumperCode); audioSource.time = 0.0f; audioSource.Play(); }
public virtual void DestroyBlock(int comboBonus) { mainManager.AddGameScore(breakScore); mainManager.AddGameScoreByComboBonus(); mainManager.AddComboBonus(comboBonus); Instantiate(prefabBlockBreakEffect, this.transform.position, new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)).GetComponent <BlockBreakEffect>().Initialize(triggerName); Instantiate(prefabItem, this.transform.position, new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)).GetComponent <Item>().Initialize(itemCode); Destroy(this.gameObject); }
public void OnCollisionSwitch(int switchId) { mainManager.AddGameScore(50); signals[switchId].GetComponent <SpriteRenderer>().sprite = spriteGreenSignal; gates[switchId].GetComponent <BonusStageSystemGateBar>().Open(); audioSource.time = 0.0f; audioSource.Play(); }
public void Damage(int countDamage) { if (countInvincible == 0) { duration -= countDamage; if (duration <= 0) { duration = 0; switch (phaseCode) { case 1: case 2: isReturned = true; StopCoroutine(currentCoroutine); StartCoroutine("ReturnToNextPhase"); break; case 3: isReturned = true; ball.DiminishForLevelUp(); musicManager.ChangeMusic(0); StopCoroutine(currentCoroutine); StartCoroutine("ReturnToExplosion"); break; } audioSources[1].time = 0.2f; audioSources[1].Play(); mainManager.AddGameScore(300); } else { audioSources[0].time = 0.07f; audioSources[0].Play(); countInvincible = 60; face.DamageFace(); mainManager.AddGameScore(30); } } }
public void OnJackpotSwitchOn(int switchCode) { float[] audioTimes = { 0.05f, 0.02f, 0.02f }; int targetCode = currentSwitchSignals[switchCode]; switch (targetCode) { case 1: jackpotStep += 1; audioSources[0].time = audioTimes[0]; audioSources[0].Play(); break; case 2: jackpotStep += 2; audioSources[0].time = audioTimes[0]; audioSources[0].Play(); break; case 3: jackpotStep += 3; audioSources[0].time = audioTimes[0]; audioSources[0].Play(); break; case 4: jackpotStep += 4; audioSources[0].time = audioTimes[0]; audioSources[0].Play(); break; case 5: jackpotStep -= 1; audioSources[2].time = audioTimes[2]; audioSources[2].Play(); break; case 6: jackpotStep -= 2; audioSources[2].time = audioTimes[2]; audioSources[2].Play(); break; case 7: jackpotStep -= 3; audioSources[2].time = audioTimes[2]; audioSources[2].Play(); break; case 8: jackpotStep -= 4; audioSources[2].time = audioTimes[2]; audioSources[2].Play(); break; case 9: jackpotStep -= 5; audioSources[2].time = audioTimes[2]; audioSources[2].Play(); break; case 10: jackpotStep = 0; if (GenerateItems()) { audioSources[4].time = 0.1f; audioSources[4].Play(); } else { audioSources[3].time = 0.1f; audioSources[3].Play(); } break; case 11: jackpotScore += 100; audioSources[1].time = audioTimes[1]; audioSources[1].Play(); break; case 12: jackpotScore += 200; audioSources[1].time = audioTimes[1]; audioSources[1].Play(); break; case 13: jackpotScore += 500; audioSources[1].time = audioTimes[1]; audioSources[1].Play(); break; case 14: jackpotScore += 1000; audioSources[1].time = audioTimes[1]; audioSources[1].Play(); break; } if (jackpotStep < 0) { jackpotStep = 0; } if (jackpotStep >= 21 && !hasGottenJackpot) { jackpotStep = 21; mainManager.AddGameScore(jackpotScore); hasGottenJackpot = true; jackpotBoard.SetTrigger("Congratulations"); gameObjectSwitchSignalsJackpot.SetActive(true); for (int i = 0; i < jackpotSwitches.Length; i++) { jackpotSwitches[i].ChangeColor("Rainbow"); } audioSources[5].time = 0.2f; audioSources[5].Play(); } ProcessSwitches(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Racket") { switch (itemCode) { case POINT_100: mainManager.AddGameScore(100); prefabSounds.GetPoint(); break; case POINT_200: mainManager.AddGameScore(200); prefabSounds.GetPoint(); break; case POINT_500: mainManager.AddGameScore(500); prefabSounds.GetPoint(); break; case POINT_1000: mainManager.AddGameScore(1000); prefabSounds.GetPoint(); break; case EXPAND_RACKET: racket.Expand(); break; case SHRINK_RACKET: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { racket.Shrink(); } break; case EXTRA_BALL: mainManager.AddRestOfBall(); prefabSounds.GetExtraBall(); break; case POWER_UP: signalManager.StartPoweredBall(1000); break; case PROTECTOR: signalManager.StartProtector(750); break; case LEVEL_UP: mainManager.AddJackpotScore(100); mainManager.LevelUp(); break; case TRAP_GUARD: signalManager.StartTrapGuard(1500); break; case GAME_OVER: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { mainManager.StartGameOver(); } break; case PRECIPITATE: signalManager.StartPrecipitate(1500); break; case SHOOTING: signalManager.StartShooting(750); break; case HOSTAGE_300: mainManager.AddGameScore(300); prefabSounds.GetPoint(); break; case NEGATIVE_POINT_200: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { mainManager.AddGameScore(-200); } break; case FLASH: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { mainManager.StartFlash(); } break; case COUNTERFEIT: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { mainManager.AddGameScore(-1000); signalManager.StopAllSignals(); racket.SetStepOfLength(1); prefabSounds.GetCounterfeit(); } break; case MAGNET: signalManager.StartMagnet(1000); break; case STICKY: signalManager.StartSticky(1500); break; case DECELERATE: ball.Decelerate(); break; case ACCELERATE: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { ball.Accelerate(); } break; case MAX_SPEED: if (signalManager.IsActiveTrapGuard()) { prefabSounds.GetNothing(); } else { ball.MaxSpeed(); } break; } Destroy(this.gameObject); } if (collision.gameObject.tag == "FailZone") { switch (itemCode) { case EXTRA_BALL: //複雑なシステムに使う break; case HOSTAGE_300: mainManager.MissingHostage300(); break; } Destroy(this.gameObject); } }
public void OnSwtichOn(int switchCode) { if (isIdle) { if (switchCode == 3) { audioSources[0].time = 0.0f; audioSources[0].Play(); mainManager.AddGameScore(5); isIdle = false; slotSwitches[switchCode].SetTrigger("Off"); slotBoard.SetTrigger("Rotating"); for (int i = 0; i < 3; i++) { vsDrumRotating[i] = true; slotDrums[i].StartDrum(); slotSwitches[i].SetTrigger("Skyblue"); } int randomNumber = Random.Range(0, 60); if (randomNumber == 0) { decidedNumbers[0] = 0; decidedNumbers[1] = 1; decidedNumbers[2] = 1; } else if (randomNumber <= 10) { isRiggedReach = false; int randomNumber2 = feverNumbers[Random.Range(0, feverNumbers.Length)]; for (int i = 0; i < 3; i++) { decidedNumbers[i] = randomNumber2; } } else if (randomNumber <= 30) { isRiggedReach = true; riggedReachNumber = feverNumbers[Random.Range(0, feverNumbers.Length)]; } else { isRiggedReach = false; for (int i = 0; i < 3; i++) { decidedNumbers[i] = Random.Range(0, 9); } } } } else { if (switchCode == 0 || switchCode == 1 || switchCode == 2) { if (vsDrumRotating[switchCode]) { audioSources[1].time = 0.0f; audioSources[1].Play(); mainManager.AddGameScore(1); vsDrumRotating[switchCode] = false; slotSwitches[switchCode].SetTrigger("Off"); if (isRiggedReach) { if (GetDramStatus() != 0) { decidedNumbers[switchCode] = riggedReachNumber; } else { decidedNumbers[switchCode] = Random.Range(0, 9); } } slotDrums[switchCode].StopDrum(decidedNumbers[switchCode]); switch (GetDramStatus()) { case 0: if (decidedNumbers[0] == decidedNumbers[1] && decidedNumbers[1] == decidedNumbers[2]) { int index = decidedNumbers[0]; int[] soundIndex = { 5, 6, 5, 5, 5, 5, 5, 6, 5 }; int[] scores = { 100, 0, 100, 100, 100, 100, 100, 0, 100 }; string[] triggers = { "Fever", "Ouch", "Excellent", "Fever", "Fever", "Fever", "Excellent", "Ouch", "Fever" }; GenerateItem(); slotBoard.SetTrigger(triggers[index]); mainManager.AddGameScore(scores[index]); audioSources[soundIndex[index]].time = 0.0f; audioSources[soundIndex[index]].Play(); } else if (decidedNumbers[0] == 0 && decidedNumbers[1] == 1 && decidedNumbers[2] == 1) { slotBoard.SetTrigger("AtelierFever"); audioSources[7].time = 0.0f; audioSources[7].Play(); mainManager.AddJackpotScore(14400); mainManager.SetHasSlot144(true); } else { slotBoard.SetTrigger("Idle"); } isIdle = true; slotSwitches[3].SetTrigger("Rainbow"); break; case 1: if (decidedNumbers[1] == decidedNumbers[2]) { int index = decidedNumbers[1]; int[] soundIndex = { 2, 4, 2, 2, 2, 2, 2, 3, 2 }; string[] triggers = { "Reach", "AtelierPinch", "Reach", "Reach", "Reach", "Reach", "Reach", "Pinch", "Reach" }; audioSources[soundIndex[index]].time = 0.0f; audioSources[soundIndex[index]].Play(); slotBoard.SetTrigger(triggers[index]); } break; case 2: if (decidedNumbers[0] == decidedNumbers[2]) { int index = decidedNumbers[0]; int[] soundIndex = { 2, 3, 2, 2, 2, 2, 2, 3, 2 }; string[] triggers = { "Reach", "Pinch", "Reach", "Reach", "Reach", "Reach", "Reach", "Pinch", "Reach" }; audioSources[soundIndex[index]].time = 0.0f; audioSources[soundIndex[index]].Play(); slotBoard.SetTrigger(triggers[index]); } else if (decidedNumbers[0] == 0 && decidedNumbers[2] == 1) { audioSources[4].time = 0.0f; audioSources[4].Play(); slotBoard.SetTrigger("AtelierReach"); } break; case 4: if (decidedNumbers[0] == decidedNumbers[1]) { int index = decidedNumbers[0]; int[] soundIndex = { 2, 3, 2, 2, 2, 2, 2, 3, 2 }; string[] triggers = { "Reach", "Pinch", "Reach", "Reach", "Reach", "Reach", "Reach", "Pinch", "Reach" }; audioSources[soundIndex[index]].time = 0.0f; audioSources[soundIndex[index]].Play(); slotBoard.SetTrigger(triggers[index]); } else if (decidedNumbers[0] == 0 && decidedNumbers[1] == 1) { audioSources[4].time = 0.0f; audioSources[4].Play(); slotBoard.SetTrigger("AtelierReach"); } break; } } } } }