private void Start() { if (flickController == null) { flickController = TopMostControl.Instance().GetController(); if (flickController == null) { Debug.LogError("FlickController is null"); } } characterScale = playerAnimator.transform.localScale.x; flickController.onPointerUp += OnPointerUp; flickController.onPointerDown += OnPointerDown; PlayerManager.Instance().onDeath += OnDeath; PlayerManager.Instance().onFinishAirTime += OnFinishAirTime; PlayerManager.Instance().onChangePlayerSkin += OnChangePlayerSkin; TopMostControl.Instance().onClickReturn += OnClickReturnButton; TopMostControl.Instance().onClickGameOverMenu += OnClickGameOverMenu; initFixedDeltaTime = Time.fixedDeltaTime; EffectManager.GetInstance(); }
public void Update() { if (TriggerOn == false && moveTrigger == GameStatics.MOVE_TRIGGER.MOVE_POSITION) { //Check portal purchase collision if (Vector3.Distance(PlayerManager.Instance().GetPlayerControl().GetPlayerRigidBody().transform.position, ToPortalOff.transform.position) < 20f) { TopMostControl.Instance().IsCollidingPortalPurchase = true; if (TopMostControl.Instance().IsShowingPortalPurchaseUI == false) { TopMostControl.Instance().ShowPortalPurchaseUI(true, this); } } else { TopMostControl.Instance().IsCollidingPortalPurchase = false; } } else { TopMostControl.Instance().IsCollidingPortalPurchase = false; } }
/// <summary> /// Awake is called when the script instance is being loaded. /// </summary> void Start() { splashImageTween.TweenCompleted += () => { TopMostControl.Instance().StartChangeScene(SCENE_INDEX.MAINMENU, true); }; splashImageTween.Begin(); }
void DestroyShard() { if (this != null) { TopMostControl.Instance().onFinishSceneFadeout -= DestroyShard; Destroy(this.gameObject); } }
/// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> void Update() { if (isFinish == false) { if (playableDirector.state != PlayState.Playing) { isFinish = true; TopMostControl.Instance().StartChangeScene(nextTargetScene, true); } } #if UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { if (touchOn == false) { touchOn = true; touchGuideTweenAlpha.Begin(); touchGuideTweenAlpha.value = touchGuideTweenAlpha.startValue; } else { if (isFinish == false) { isFinish = true; TopMostControl.Instance().StartChangeScene(nextTargetScene, true); } } } #else if (Input.touchCount > 0) { for (int i = 0; i < Input.touchCount; i++) { tempTouchs = Input.GetTouch(i); if (tempTouchs.phase == TouchPhase.Began) { if (touchOn == false) { touchOn = true; touchGuideTweenAlpha.Begin(); touchGuideTweenAlpha.value = touchGuideTweenAlpha.startValue; } else { if (isFinish == false) { isFinish = true; TopMostControl.Instance().StartChangeScene(nextTargetScene, true); } } break; } } } #endif }
private void OnApplicationPause(bool pause) { if (pause) { GameConfigs.SetPlayTime(TopMostControl.Instance().playUnixTime); } else { //Time_LatestStartGame = DateTime.UtcNow; } }
private void OnDestroy() { if (playerStatus != null) { playerStatus.onChangePlayerStatus -= OnChangePlayerStatus; } if (TopMostControl.HasInstance()) { TopMostControl.Instance().onClickGameOverMenu -= OnClickGameOverMenu; } }
/// <summary> /// This function is called when the behaviour becomes disabled or inactive. /// </summary> void OnDisable() { if (PlayerManager.HasInstance()) { PlayerManager.Instance().onDamaged -= OnDamaged; } if (TopMostControl.HasInstance()) { TopMostControl.Instance().onCameraShake -= CameraShake_Rot; } }
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 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 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 StartChangeScene(SCENE_INDEX targetSceneIndex, bool smoothChange, int nextStageNum = 1) { topCanvas.sortingOrder = 10; isChangingState = true; blackPanelAlpha.startValue = 0f; blackPanelAlpha.endValue = 1f; currentTargetScene = targetSceneIndex; blackPanelAlpha.TweenCompleted += SceneFadeoutFinishEvent; blackPanelAlpha.Begin(); blackPanelAlpha.value = blackPanelAlpha.startValue; StageLoader.NextStage = nextStageNum; GameConfigs.SetPlayTime(TopMostControl.Instance().playUnixTime); }
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); } } }
bool CheckControllableStatus() { if (PlayerManager.Instance().IsDead) { return(false); } if (PlayerManager.Instance().IsTriggerEnding) { return(false); } if (TopMostControl.Instance().GetIsSceneChanging() == true) { return(false); } return(true); }
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); } } }
public void SetShard(SHARD_TYPE shardType, Vector3 worldPos, Transform chasingTargetTrans, bool isChasingTarget = false) { this.shardType = shardType; this.transform.position = worldPos; this.chasingTargetTrans = chasingTargetTrans; curChaseSpeed = 0f; if (isChasingTarget) { StartChasing(); } if (alreadyInitialize == false) { alreadyInitialize = true; TopMostControl.Instance().onFinishSceneFadeout += DestroyShard; } tweenColor.endColor = Color_pullDist; }
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); } }
private void OnDestroy() { if (flickController != null) { flickController.onPointerUp -= OnPointerUp; flickController.onPointerDown -= OnPointerDown; } if (PlayerManager.HasInstance()) { PlayerManager.Instance().onDeath -= OnDeath; PlayerManager.Instance().onFinishAirTime -= OnFinishAirTime; PlayerManager.Instance().onChangePlayerSkin -= OnChangePlayerSkin; } if (TopMostControl.HasInstance()) { TopMostControl.Instance().onClickReturn -= OnClickReturnButton; TopMostControl.Instance().onClickGameOverMenu -= OnClickGameOverMenu; } }
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); } }
private void Awake() { if (instance == null) { container = this.gameObject; container.name = "PlayerManager"; instance = GetComponent <PlayerManager>(); DontDestroyOnLoad(this); } SetPlayerController(false); if (playerStatus == null) { playerStatus = new PlayerStatus(); } playerStatus.onChangePlayerStatus += OnChangePlayerStatus; TopMostControl.Instance().onClickGameOverMenu += OnClickGameOverMenu; onChangePlayerStatus += TopMostControl.Instance().OnChangePlayerStatus; GameManager.Instance().onUserEarnedReward_Revive += OnUserEarnedReward_Revive; }
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); }); }
/// <summary> /// This function is called when the object becomes enabled and active. /// </summary> void OnEnable() { PlayerManager.Instance().onDamaged += OnDamaged; TopMostControl.Instance().onCameraShake += CameraShake_Rot; }
// Update is called once per frame void Update() { targetPos = player.transform.position; if (targetPos.y < GameStatics.GetCameraMinimumYAxis(StageLoader.CurrentStage)) { targetPos.y = GetCameraMinimumYAxis(StageLoader.CurrentStage); } if (camFixedXAxis) { if (targetPos.x < levelMinXAxis) { targetPos.x = levelMinXAxis; } if (targetPos.x > levelMaxXAxis) { targetPos.x = levelMaxXAxis; } } // Stage3 Last Camera Move if (StageLoader.CurrentStage == 3) { if (player.transform.position.y > 1715 && (player.transform.position.x > -3 && player.transform.position.x < 120)) { // Last Jump targetPos.x = 82; targetPos.y = 1718; } else if (player.transform.position.y > 1700 && player.transform.position.x >= 120) { // Ending Trigger targetPos.x = 145; targetPos.y = 1720; if (!PlayerManager.Instance().IsTriggerEnding&& player.IsGround()) { PlayerManager.Instance().IsTriggerEnding = true; } } } // Stage 1 Tutorial if (GameConfigs.GetWatchedTutorial() == false) { if (StageLoader.CurrentStage == 1) { if (player.isFainting == false && player.IsGround() && TopMostControl.Instance().startShowTutorialPopup1 == false) { TopMostControl.Instance().startShowTutorialPopup1 = true; TopMostControl.Instance().PopupSingle.ShowPopup( "<color=cyan>JUMP</color>", "<color=yellow>Draw Finger</color> to decide the direction\n\n" + "<color=yellow>Release</color> to Jump"); } if (player.transform.position.x > 30 && TopMostControl.Instance().startShowTutorialPopup2 == false) { TopMostControl.Instance().startShowTutorialPopup2 = true; TopMostControl.Instance().PopupSingle.ShowPopup( "<color=cyan>AIR TIME</color>", "<color=yellow>Hold Touch</color> to slow time in the Air", () => { TopMostControl.Instance().PopupSingle.ShowPopup( "<color=cyan>DOUBLE JUMP</color>", "<color=yellow>JUMP</color> in the Air time", () => { GameConfigs.SetWatchedTutorial(true); }); }); } } } // Check Upgrade Status if (TopMostControl.Instance().GetGameUIStatus() == TOPUI_STATUS.GAMEOVER) { targetPos.y = player.transform.position.y + UpgradeUIYOffset; } if (IsShakingCamera == false) { cameraTransform.position = Vector2.Lerp(cameraTransform.position, targetPos, 0.2f); cameraTransform.position = new Vector3(cameraTransform.position.x, cameraTransform.position.y, -10f); } }
public void OnClickSetStage() { TopMostControl.Instance().StartChangeScene(GameStatics.SCENE_INDEX.GAMESTAGE, true, int.Parse(stageString.text)); }
void Start() { // -- Camera Init -- // 9 x 16 // 1600 x 900 : cameraOrthogonalInitialSize float screenRatio = (float)Screen.width / (float)Screen.height; float targetRatio = 9f / 16f; if (screenRatio >= targetRatio) { cam.orthographicSize = 160f; } else { float differenceInSize = targetRatio / screenRatio; cam.orthographicSize = 160f * differenceInSize; } // -- Camera Init -- if (PlayerManager.Instance().PlayMode == PLAY_MODE.TRUE) { Show_NormalObject.SetActive(false); Show_Ending1Object.SetActive(true); mainTitle_animatingStart = true; mainTitle_transformTween.Begin(); mainTitle.transform.localPosition = mainTitle_transformTween.startingVector; Btn_Newgame.Begin(); Btn_Newgame.transform.localPosition = Btn_Newgame.startingVector; if (GameConfigs.GetNormalEnding() == true) { Btn_ChangeMode.Begin(); Btn_ChangeMode.transform.localPosition = Btn_ChangeMode.startingVector; } global2DLight.intensity = globalLight2D_intensityBlink.endValue; } else { Show_NormalObject.SetActive(true); Show_Ending1Object.SetActive(false); } if (GameConfigs.GetNormalEnding() == true) { SetChangeModeText(PlayerManager.Instance().PlayMode); } Btn_Newgame.transform.localPosition = Btn_Newgame.startingVector; Btn_ChangeMode.transform.localPosition = Btn_ChangeMode.startingVector; mainTitle.transform.localPosition = mainTitle_transformTween.startingVector; //TopMostControl.Instance().GetController().onPointerDown += OnPointerDown; // Animating light1_intensityTween.TweenCompleted += () => { //if (!isEndAnimating) //{ light1_angleTweenStart = true; light1_outherAngleTween.Begin(); light1_outherAngleTween.value = light1_outherAngleTween.startValue; //} }; light1_outherAngleTween.TweenCompleted += () => { light1_intensityFadeoutStart = true; if (!isEndAnimating) { light1_angleTweenStart = false; global2DLight_blink = true; light1_intensityTweenFadeout.Begin(); light1_intensityTweenFadeout.value = light1_intensityTweenFadeout.startValue; globalLight2D_intensityBlink.Begin(); globalLight2D_intensityBlink.value = globalLight2D_intensityBlink.startValue; } }; light1_intensityTweenFadeout.TweenCompleted += () => { if (!isEndAnimating && !mainTitle_animatingStart) { mainTitle_animatingStart = true; mainTitle_transformTween.Begin(); mainTitle.transform.localPosition = mainTitle_transformTween.startingVector; Btn_Newgame.Begin(); Btn_Newgame.transform.localPosition = Btn_Newgame.startingVector; if (GameConfigs.GetNormalEnding() == true) { Btn_ChangeMode.Begin(); Btn_ChangeMode.transform.localPosition = Btn_ChangeMode.startingVector; } } }; mainTitle_transformTween.TweenCompleted += () => { isEndAnimating = true; TopMostControl.Instance().SettingShowButton.SetActive(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; } } }
private void OnApplicationQuit() { GameConfigs.SetPlayTime(TopMostControl.Instance().playUnixTime); }