Пример #1
0
    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;
    }
Пример #2
0
    static SoundContainer BuildSoundContainer()
    {
        GameObject     g         = new GameObject();
        SoundContainer container = new SoundContainer();

        container.audioSource = g.AddComponent <AudioSource>();
        g.transform.parent    = I.transform;
        return(container);
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        //portal.SetActive(false);
        _soundContainer  = SoundContainer.Instance;
        _soundSource     = _soundContainer.GetComponent <AudioSource>();
        _languageManager = LanguageManager.Instance;
        _hudCanvas       = GameObject.FindWithTag("HUD").GetComponent <PopUpManager>();

        dialogueCallback = DialogueEventCallback;
        Invoke("EstellaAppears", 2);
    }
Пример #4
0
        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();
        }
Пример #5
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         //DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #6
0
    public void PlaySound(string name)
    {
        SoundContainer playingSound = soundContainers.Find(sound => sound.clipName == name);

        if (playingSound == null)
        {
            Debug.LogWarning("Couldn't find the sound:" + name);
            return;
        }

        playingSound.source.Play();
    }
Пример #7
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;
        }
    }
Пример #8
0
    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);
    }
Пример #9
0
    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);
        }
    }
Пример #10
0
    /**
     * The method that builds a sound object and plays it. It is recommended that you avoid using this method directly,
     * but it can still be useful. The functions for controlling the sound can be found in the SoundInterface that is returned.
     */
    public static SoundInterface PlaySoundGeneric(string soundName, SoundChannel channel)
    {
        TryCreate();

        if (!I.clipCache.ContainsKey(soundName))
        {
            PreLoad(soundName);
        }

        SoundContainer container = null;

        if (I.inactivePool.Count > 0)
        {
            container = I.inactivePool.First.Value;
            I.inactivePool.RemoveFirst();
        }
        else
        {
            container = BuildSoundContainer();
        }

        container.channel        = channel;
        container.soundName      = soundName;
        container.state          = SoundMetaState.FADE_IN_ALIVE;
        container.track          = null;
        container.persistent     = false;
        container.fadeScalar     = 0;
        container.paused         = false;
        container.overrideVolume = false;
        container.onCompleted    = null;

        container.audioSource.enabled      = true;
        container.audioSource.volume       = GetVolume(channel);
        container.audioSource.loop         = false;
        container.audioSource.clip         = I.clipCache[soundName];
        container.audioSource.spatialBlend = 0;
        container.audioSource.UnPause();
        container.audioSource.Play();

        container.audioSource.gameObject.name = soundName;

        I.activePool.AddLast(container);

        return(new SoundInterface(container));
    }
Пример #11
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);
            }
        }
    }
Пример #12
0
    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);
        }
    }
Пример #13
0
        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);
        }