コード例 #1
0
    public void ShowUpgradeUI(bool isShow)
    {
        if (isShow)
        {
            GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards);

            upgradeUITweener.gameObject.SetActive(true);

            upgradeUITweener.startingVector = outXPos_upgradeUI;
            upgradeUITweener.endVector      = inXPos_upgradeUI;

            SetUpgradeInfos(upgradeElements);

            Vibration.Vibrate(100);
            SoundManager.StopAllLoopingSounds();
            if (onCameraShake != null)
            {
                onCameraShake(5);
            }
        }
        else
        {
            upgradeUITweener.startingVector = inXPos_upgradeUI;
            upgradeUITweener.endVector      = outXPos_upgradeUI;

            upgradeUITweener.TweenCompleted += DeactiveUpgradeUIAfterTweenComplete;

            currentGameUIStatus = TOPUI_STATUS.NORMAL;
        }

        isShowingUpgradeUI = isShow;
        upgradeUITweener.Begin();
        upgradeUITweener.defaultVector = upgradeUITweener.startingVector;
    }
コード例 #2
0
    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;
        }
    }
コード例 #3
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);
            }
        }
    }
コード例 #4
0
    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);
                }
            }
        }
    }
コード例 #5
0
    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;
            }
        }
    }