void OnPointerUp() { if (flickController.GetFlickedVector().magnitude > 1f && currentRemainJump > 0) { if (isGround == false) { playerRigidbody2D.velocity = Vector2.zero; playerRigidbody2D.AddForce(-flickController.GetFlickedVector(), ForceMode2D.Impulse); isAirJump = true; Vibration.Vibrate(1); if (flickController.GetFlickedVector().magnitude >= 100f) { // Double Jump bool xReverse = (flickController.GetFlickedVector().x < 0) ? true : false; Vector3 effTargetPos = Vector3.zero; EffectManager.GetInstance().playEffect(effTargetPos, GameStatics.EFFECT.JUMP_TWICE, flickController.GetFlickedVector(), xReverse, this.transform); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_doubleJump], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_doubleJump].clip); } } else if (isGround == true && isFainting == false) { // Ground Jump! if (flickController.GetFlickedVector().y < 0 && !playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("player_standup")) { playerRigidbody2D.velocity = Vector2.zero; playerRigidbody2D.AddForce(-flickController.GetFlickedVector(), ForceMode2D.Impulse); if (flickController.GetFlickedVector().magnitude >= 100f) { bool xReverse = (flickController.GetFlickedVector().x < 0) ? true : false; Vector3 effTargetPos = groundCheckCenter.position; effTargetPos.y = groundCheckCenter.position.y + 7.3f; if (xReverse) { effTargetPos.x = groundCheckCenter.position.x - 5f; } else { effTargetPos.x = groundCheckCenter.position.x + 5f; } EffectManager.GetInstance().playEffect(effTargetPos, GameStatics.EFFECT.JUMP_SMOKE, Vector2.zero, xReverse); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_jump], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_jump].clip); } } } } PlayerManager.Instance().SetAirTimeFinish(); airJumpLight.Hide(); currentRemainJump -= 1; timescale = 1.0f; }
public void OnClickChangePlayMode() { if (PlayerManager.Instance().PlayMode == PLAY_MODE.NORMAL) { PlayerManager.Instance().PlayMode = PLAY_MODE.TRUE; GameConfigs.SetLastPlayMode(PLAY_MODE.TRUE); Show_NormalObject.SetActive(false); Show_Ending1Object.SetActive(true); SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Ending"], 1.0f, 1.0f, true); } else { PlayerManager.Instance().PlayMode = PLAY_MODE.NORMAL; GameConfigs.SetLastPlayMode(PLAY_MODE.NORMAL); Show_NormalObject.SetActive(true); Show_Ending1Object.SetActive(false); SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["Opening"], 1.0f, 1.0f, true); } SetChangeModeText(PlayerManager.Instance().PlayMode); ChangeModeCameraTween.Begin(); ChangeModeCameraTween.vector3Results = ChangeModeCameraTween.startingVector; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); }
void Update() { CheckActivateTrap(); if (activatingTrap == true) { if (currentPatternIndex < shootDelayPattern.Length) { currentTimer += Time.deltaTime; // Sprite Color Warning SpriteColorWarning(currentTimer, shootDelayPattern[currentPatternIndex].delay); // Light Shoot Guide LightGuideWarning(currentTimer, shootDelayPattern[currentPatternIndex].delay); if (currentTimer >= shootDelayPattern[currentPatternIndex].delay) { // Shoot! GameObject go = Instantiate(projectile.gameObject, this.transform.position + (this.transform.up * 10), this.transform.localRotation) as GameObject; go.SetActive(true); DirectionalProjectile proj = go.GetComponent <DirectionalProjectile>(); proj.Fire(shootDelayPattern[currentPatternIndex].speed, projectileType); currentTimer = 0; if (IsFollowPlayer == true) { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_trapFire1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_trapFire1].clip); } if (++currentPatternIndex >= shootDelayPattern.Length) { currentPatternIndex = 0; } } } if (IsFollowPlayer == true) { if (PlayerManager.Instance().GetPlayerControl() != null) { Vector3 targetPos = PlayerManager.Instance().GetPlayerControl().GetPlayerRigidBody().transform.position - (Vector3.up * 3); Vector3 followDirection = (targetPos - this.transform.position).normalized; this.transform.up = followDirection; } } } else { if (shootGuideLight != null) { shootGuideLight.intensity = 0; } } }
private void ShowInPopupList() { popupBase showingPopup = popupList.Peek(); textTitle.text = showingPopup.title; textDesc.text = showingPopup.desc; this.transform.localPosition = Vector3.zero; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); }
public void OnClickSettingHide() { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); IsSettingState = false; SettingControlTweenTrans.startingVector = inXPos_SettingControl; SettingControlTweenTrans.endVector = outXPos_SettingControl; SettingControlTweenTrans.TweenCompleted += SettingControlFadeoutFinish; SettingControlTweenTrans.Begin(); SettingControlTweenTrans.defaultVector = SettingControlTweenTrans.startingVector; }
private async UniTask PrepareGameTask() { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Stage1"], 1, 1, true); await MapManager.Instance.GenerateMap(); await UniTask.Delay(1000); await CharacterManager.Instance.GenerateCharacter(); await StartGameTask(); }
void OnClickGameOverMenu(MENU_GAMEOVER gameOverMenu) { switch (gameOverMenu) { case MENU_GAMEOVER.MAINMENU: // Save Memory Shards.. GameConfigs.SetCurrentMemoryShards(PlayerStatus.CurrentMemoryShards); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); break; case MENU_GAMEOVER.RETRY: // Save Memory Shards.. GameConfigs.SetCurrentMemoryShards(PlayerStatus.CurrentMemoryShards); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); break; case MENU_GAMEOVER.REVIVE_SHARDS: if (PlayerStatus.RemainReviveCount > 0) { Vibration.Vibrate(100); PlayerStatus.CurrentMemoryShards -= TopMostControl.Instance().GetRequiredShardsForRevive(); PlayerStatus.CurrentHP = PlayerStatus.MaxHP; PlayerStatus.RemainReviveCount -= 1; TopMostControl.Instance().StartGlobalLightEffect(Color.yellow, 2f, 0.2f); TopMostControl.Instance().GameOver(false); if (cameraController != null) { cameraController.CameraShake_Rot(3); } EffectManager.GetInstance().playEffect(playerController.GetPlayerRigidBody().transform.position, EFFECT.YELLOW_PILLAR, Vector2.zero); TopMostControl.Instance().StartBGM(SceneManager.GetActiveScene()); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive].clip); Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_REVIVE_SHARD); } break; case MENU_GAMEOVER.REVIVE_AD: GameManager.Instance().ShowReviveAds(); break; default: break; } }
public void OnGround() { // If player grounded, SetAirTimeFinish(); if (IsDead) { // GameOver Check (by check current hp) TopMostControl.Instance().GameOver(true); } else { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_jumpStomp], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_jumpStomp].clip); } }
public void OnGetShard(MemoryShard shard) { if (shard.GetShardType() == SHARD_TYPE.SHARD1 || shard.GetShardType() == SHARD_TYPE.SHARD2) { int resultShardAmount = (int)(StageLoader.Instance().GetRandomShard(shard.GetShardType()) * StageLoader.Instance().GetShardMultifly()); PlayerStatus.CurrentMemoryShards += resultShardAmount; playerController.ShowShardGetText(resultShardAmount); } TopMostControl.Instance().StartGlobalLightEffect(shard.GetShardTargetColor(), 0.5f, 0.1f); GetPlayerControl().BlinkPlayerShardLight(shard.GetShardTargetColor()); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_gainShard], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_gainShard].clip); }
public void OnClickSettingShow() { bool possibleSettingShow = false; if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.MAINMENU) { possibleSettingShow = true; } else if ((SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.GAMESTAGE) && PlayerManager.Instance().GetPlayerControl().IsGround()) { possibleSettingShow = true; } if (possibleSettingShow) { topCanvas.sortingOrder = 10; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); IsSettingState = true; SettingControlTweenTrans.gameObject.SetActive(true); SettingControlTweenTrans.startingVector = outXPos_SettingControl; SettingControlTweenTrans.endVector = inXPos_SettingControl; if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.MAINMENU) { SettingGoBackText.text = "Exit Game"; } else { SettingGoBackText.text = "Main Menu"; } SettingControlTweenTrans.Begin(); SettingControlTweenTrans.defaultVector = SettingControlTweenTrans.startingVector; if (slider_bgm != null && slider_sfx != null) { slider_bgm.SetValueWithoutNotify(SoundManager.MusicVolume); slider_sfx.SetValueWithoutNotify(SoundManager.SoundVolume); } if (toggle_vibrate != null) { toggle_vibrate.SetIsOnWithoutNotify(GameConfigs.GetIsVibrate()); } } }
public void OnClickNewGame() { if (TopMostControl.Instance().GetIsSceneChanging() == false) { TopMostControl.Instance().StartChangeScene(SCENE_INDEX.CUTSCENE, true); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); if (PlayerManager.Instance().PlayMode == PLAY_MODE.NORMAL) { Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_START_GAME_NORMAL); } else if (PlayerManager.Instance().PlayMode == PLAY_MODE.TRUE) { Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_START_GAME_TRUEHERO); } } }
public void OnClickClose() { popupBase closePopup = popupList.Dequeue(); closePopup.closeCallback?.Invoke(); if (popupList.Count > 0) { // if popup exist ShowInPopupList(); } else { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); this.transform.localPosition = new Vector3(hideXAxis, 0, 0); } }
void OnClickReturnButton() { // Death for Upgrade if (isGround && !PlayerManager.Instance().IsDead&& !startDeathForUpgradeAct) { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround].clip); startDeathForUpgradeAct = true; PlayerManager.Instance().PlayerStatus.CurrentHP = 0; damagedLight.StartBlink(2f, Color.red); TopMostControl.Instance().GameOver(true); TopMostControl.Instance().StartGlobalLightEffect(Color.magenta, 3f, 0.3f); if (PlayerManager.Instance().CameraController() != null) { PlayerManager.Instance().CameraController().CameraShake_Rot(3); } } }
private void Update() { if (CheckActivateTrap() == true) { if (currentPatternIndex < quakePatterns.Length) { currentUnscaledTimer += Time.unscaledDeltaTime; SetLightIntensity(currentUnscaledTimer, quakePatterns[currentPatternIndex].delay); if (currentUnscaledTimer >= quakePatterns[currentPatternIndex].delay) { // Quake! if (PlayerManager.Instance().playerController.IsGround() && PlayerManager.Instance().playerController.GetPlayerRigidBody().transform.position.y > damageAreaMinY.position.y && PlayerManager.Instance().playerController.GetPlayerRigidBody().transform.position.y < damageAreaMaxY.position.y) { if (!PlayerManager.Instance().IsDead&& PlayerManager.Instance().playerController.canTriggerHurt&& !PlayerManager.Instance().playerController.reviveTime) { StartCoroutine(PlayerManager.Instance().playerController.TriggerHurt(null, PlayerManager.Instance().playerController.unbeatableDuration_hurt)); PlayerManager.Instance().playerController.isFainting = true; PlayerManager.Instance().OnDamaged(GameStatics.DAMAGED_TYPE.EARTH_QUAKE); } } SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_trapFire1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_trapFire1].clip); PlayerManager.Instance().CameraController().CameraShake_Rot(1); currentUnscaledTimer = 0; if (++currentPatternIndex >= quakePatterns.Length) { currentPatternIndex = 0; } } } } }
void OnClickUpgradeButton(SKILL_TYPE skillType) { // Upgrade Possible if ((GetRequiredShardsForUpgrade(skillType) <= PlayerManager.Instance().PlayerStatus.CurrentMemoryShards) && (currentGameUIStatus == TOPUI_STATUS.GAMEOVER)) { int requiredShards = GetRequiredShardsForUpgrade(skillType); PlayerManager.Instance().PlayerStatus.CurrentMemoryShards -= requiredShards; GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); GameConfigs.SetSkillLevel(skillType, GameConfigs.SkillLevel(skillType) + 1); foreach (UpgradeElement element in upgradeElements) { element.SetInfo(); } int effectShardAmount = (GameConfigs.SkillLevel(skillType) / 3) + 1; if (effectShardAmount < 1) { effectShardAmount = 1; } if (effectShardAmount > 10) { effectShardAmount = 10; } StageLoader.Instance().Generate_SkillUpgradeEffectShards(skillType, effectShardAmount); Vibration.Vibrate(3); StartGlobalLightEffect(Color.white, 1f, 0.2f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp].clip); if (onCameraShake != null) { onCameraShake(2); } } }
public void OnDamaged(DAMAGED_TYPE damageType) { SetAirTimeFinish(); playerStatus.CurrentHP -= GameStatics.GetDamagePoints(damageType); playerController.ShowDamageText(GameStatics.GetDamagePoints(damageType)); switch (damageType) { case DAMAGED_TYPE.SPIKE: TopMostControl.Instance().StartGlobalLightEffect(Color.red, 1f, 0.2f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall].clip); break; case DAMAGED_TYPE.FALLING_GROUND: TopMostControl.Instance().StartGlobalLightEffect(Color.red, 2f, 0.4f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround].clip); break; case DAMAGED_TYPE.PROJECTILE_SHOOTER1: TopMostControl.Instance().StartGlobalLightEffect(Color.red, 1f, 0.2f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall].clip); break; case DAMAGED_TYPE.PROJECTILE_SHOOTER2: TopMostControl.Instance().StartGlobalLightEffect(Color.red, 1f, 0.2f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_hitWall].clip); break; case DAMAGED_TYPE.EARTH_QUAKE: TopMostControl.Instance().StartGlobalLightEffect(Color.red, 2f, 0.4f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_fallGround].clip); break; default: break; } if (onDamaged != null) { onDamaged(damageType); } }
public void OnClickPortalPurchase() { if (currentSelectedPortalTrigger != null) { if (GameStatics.GetPortalOpenCost(currentSelectedPortalTrigger.portalType) <= PlayerManager.Instance().PlayerStatus.CurrentMemoryShards) { // Open the portal PlayerManager.Instance().PlayerStatus.CurrentMemoryShards -= GameStatics.GetPortalOpenCost(currentSelectedPortalTrigger.portalType); GameConfigs.SetPortalStatus(currentSelectedPortalTrigger.portalType, true); GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); currentSelectedPortalTrigger.SetPortal(true); StartGlobalLightEffect(Color.magenta, 4f, 0.6f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp].clip); if (onCameraShake != null) { onCameraShake(7); } } } }
public void StartBGM(Scene targetScene) { SoundManager.StopAllLoopingSounds(); switch (targetScene.buildIndex) { case (int)SCENE_INDEX.MAINMENU: { if (PlayerManager.Instance().PlayMode == PLAY_MODE.NORMAL) { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["Opening"], 1.0f, 1.0f, true); } else if (PlayerManager.Instance().PlayMode == PLAY_MODE.TRUE) { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Ending"], 1.0f, 1.0f, true); } } break; case (int)SCENE_INDEX.GAMESTAGE: if (StageLoader.CurrentStage == 1) { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Stage1"], 1.0f, 1.0f, true); } else if (StageLoader.CurrentStage == 2) { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Stage2"], 1.0f, 1.0f, true); } else if (StageLoader.CurrentStage == 3) { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Stage3"], 1.0f, 1.0f, true); } break; default: break; } }
public async UniTask StartOpeningTask() { SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Opening"], 1, 1, true); await UniTask.Delay((firstDelay * 1000).ToInt()); await UniTask.WhenAll ( RotateObject(cube, Quaternion.Euler(45f, 0f, 0f), firstrotateDuration), RotateObject(title.gameObject, Quaternion.Euler(45f, 0f, 0f), firstrotateDuration), ChangeColor(openingCamera, secondColor, firstrotateDuration) ); await UniTask.Delay((secondDelay * 1000).ToInt()); await UniTask.WhenAll ( RotateObject(cube, Quaternion.Euler(45f, 0f, 45f), secondrotateDuration), RotateObject(title.gameObject, Quaternion.Euler(45f, 0f, -45f), secondrotateDuration), ChangeColor(openingCamera, thirdColor, secondrotateDuration) ); await UniTask.Delay((thirdDelay * 1000).ToInt()); title.font = secondFont; await UniTask.Delay((fourthDelay * 1000).ToInt()); await UniTask.WhenAll ( MoveObject(cube, finalCubePosition, fourthrotateDuration), MoveObject(title.gameObject, finalTitlePosition, fourthrotateDuration) ); press.gameObject.SetActive(true); await UniTask.WaitUntil(() => Input.GetKeyDown(KeyCode.Space)); await SceneManager.LoadSceneAsync(nextScene); }
public void Update() { if (firing) { timer += Time.deltaTime; if (timer > patternList[curPatternIndex].delay) { if (patternList[curPatternIndex].bulletType != GameStatics.BULLET_TYPE.NONE) { BulletManager.Instance().FireBullet(patternList[curPatternIndex].bulletType, this.transform.position, 5f, patternList[curPatternIndex].speed, patternList[curPatternIndex].acceleration, this.transform.forward); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic["sound_fire1"], SoundContainer.Instance().SoundEffectsDic["sound_fire1"].clip); } if (++curPatternIndex >= patternList.Count) { curPatternIndex = 0; } timer = 0; } } }
void OnUserEarnedReward_Revive() { // Success View Ads for Revive if (PlayerStatus.RemainReviveCount > 0) { Vibration.Vibrate(100); PlayerStatus.CurrentHP = PlayerStatus.MaxHP; PlayerStatus.RemainReviveCount -= 1; TopMostControl.Instance().StartGlobalLightEffect(Color.yellow, 2f, 0.2f); TopMostControl.Instance().GameOver(false); if (cameraController != null) { cameraController.CameraShake_Rot(3); } EffectManager.GetInstance().playEffect(playerController.GetPlayerRigidBody().transform.position, EFFECT.YELLOW_PILLAR, Vector2.zero); TopMostControl.Instance().StartBGM(SceneManager.GetActiveScene()); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive].clip); Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_REVIVE_ADS); } }
IEnumerator ShowEnding() { TopMostControl.Instance().SettingShowButton.SetActive(false); TopMostControl.Instance().ReturnButton.SetActive(false); SoundManager.StopAllLoopingSounds(); TimeSpan curPlayTimeSpan = TimeSpan.FromSeconds(TopMostControl.Instance().playUnixTime); string playTimeText = string.Format("{0}:{1}:{2}", curPlayTimeSpan.Hours, curPlayTimeSpan.Minutes.ToString("D2"), curPlayTimeSpan.Seconds.ToString("D2")); yield return(new WaitForSeconds(1f)); // 1. Play Victory Sound SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_victory], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_victory].clip); yield return(new WaitForSeconds(3f)); // 2. Show Confetti Effect Vector3 blast1 = cameraController.GetTargetPos(); blast1.y += 60f; Vector3 blast2 = cameraController.GetTargetPos(); blast2.y += 50f; blast2.x -= 20f; Vector3 blast3 = cameraController.GetTargetPos(); blast3.y += 70f; blast3.x += 20f; Vector3 directional_left = cameraController.GetTargetPos(); directional_left.y += 150f; directional_left.x -= 90f; Vector3 directional_right = cameraController.GetTargetPos(); directional_right.y += 150f; directional_right.x += 90f; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); EffectManager.GetInstance().playEffect(directional_left, EFFECT.CONFETTI_DIRECTIONAL, Vector2.zero, false); yield return(new WaitForSeconds(0.5f)); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); EffectManager.GetInstance().playEffect(directional_right, EFFECT.CONFETTI_DIRECTIONAL, Vector2.zero, true); yield return(new WaitForSeconds(1f)); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); EffectManager.GetInstance().playEffect(blast1, EFFECT.CONFETTI_BLAST, Vector2.zero); yield return(new WaitForSeconds(0.3f)); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); EffectManager.GetInstance().playEffect(blast2, EFFECT.CONFETTI_BLAST, Vector2.zero); yield return(new WaitForSeconds(0.3f)); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); EffectManager.GetInstance().playEffect(blast3, EFFECT.CONFETTI_BLAST, Vector2.zero); yield return(new WaitForSeconds(3f)); // 3. Show Records TopMostControl.Instance().PopupSingle.ShowPopup( "<color=yellow>Contraturation !</color>", "<color=white>PlayTime:</color> " + "<color=red>" + playTimeText + "</color>"); TopMostControl.Instance().PopupSingle.ShowPopup( "<color=yellow>CLEAR Normal Mode</color>", "<color=red>True Hero Mode</color>\n <color=white>is Unlocked!</color>", () => { TopMostControl.Instance().StartChangeScene(SCENE_INDEX.MAINMENU, true); }); }
void OnTriggerStay2D(Collider2D collider) { if (PlayerManager.Instance().IsDead) { return; } if (collider != null) { switch (collider.tag) { case "Damage_spike": { if (canTriggerHurt && !reviveTime) { //Debug.Log("Damage_spike"); //Debug.Log("---------------------Hit!"); damagedLight.StartBlink(this.unbeatableDuration_hurt, Color.red); StartCoroutine(TriggerHurt(collider, this.unbeatableDuration_hurt)); PlayerManager.Instance().OnDamaged(DAMAGED_TYPE.SPIKE); } } break; case "MoveTrigger": { MoveTrigger trigger = collider.GetComponent <MoveTrigger>(); if (trigger != null) { if (trigger.TriggerOn) { if (trigger.moveTrigger == MOVE_TRIGGER.MOVE_POSITION) { Transform tempTarget = collider.GetComponent <MoveTrigger>().targetPosition; playerRigidbody2D.position = new Vector2(tempTarget.position.x, tempTarget.position.y); //playerRigidbody2D.MovePosition(new Vector2(tempTarget.position.x, tempTarget.position.y)); playerRigidbody2D.velocity = Vector2.zero; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_portalMove], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_portalMove].clip); } else if (trigger.moveTrigger == MOVE_TRIGGER.MOVE_NEXTSTAGE) { GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); TopMostControl.Instance().StartChangeScene(SCENE_INDEX.GAMESTAGE, true, StageLoader.CurrentStage + 1); trigger.TriggerOn = false; if (StageLoader.CurrentStage == 1) { Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_CLEAR_STAGE1); } else if (StageLoader.CurrentStage == 2) { Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_CLEAR_STAGE2); } } } } } break; case "Projectile1": { if (canTriggerHurt && !reviveTime) { DirectionalProjectile proj = collider.GetComponent <DirectionalProjectile>(); proj.HitSomething(); damagedLight.StartBlink(this.unbeatableDuration_hurt, Color.red); StartCoroutine(TriggerHurt(collider, this.unbeatableDuration_hurt)); PlayerManager.Instance().OnDamaged(DAMAGED_TYPE.PROJECTILE_SHOOTER1); } } break; case "Projectile2": { if (canTriggerHurt && !reviveTime) { DirectionalProjectile proj = collider.GetComponent <DirectionalProjectile>(); proj.HitSomething(); damagedLight.StartBlink(this.unbeatableDuration_hurt, Color.red); StartCoroutine(TriggerHurt(collider, this.unbeatableDuration_hurt)); PlayerManager.Instance().OnDamaged(DAMAGED_TYPE.PROJECTILE_SHOOTER2); } } break; } } }
public void OnChangeVibrateToggle() { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); GameConfigs.SetIsVibrate(toggle_vibrate.isOn); }
public void OnClickCloseCreditView() { SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); creditViewObj.SetActive(false); }