コード例 #1
0
    //**************************************************************************
    //
    // Public
    //
    //**************************************************************************

    override public void PerformAction()
    {
        if (blocks.Count == 0)
        {
            return;
        }

        BaseBlock block = blocks[blocks.Count - 1];

        blocks.Remove(block);

        int targetY = fieldData.TraceVertical(xPosition, yPosition + blocks.Count - 3, true);

        if (targetY >= 0)
        {
            fieldData.FillPoint(xPosition, targetY);
            currentCollisionData.geometry[0, blocks.Count] = 0;
            SendMessageUpwards(BlockController.CALLBACK_HANDLE_SHOT, block);
            block.xPosition = xPosition;
            block.yPosition = targetY;
        }

        if (blocks.Count == 0)
        {
            NotifyFigureLanded();
        }
        else
        {
            blocks[blocks.Count - 1].SetupActiveAppearance();
        }

        SoundPlaybackController sound = SoundPlayer.Instance.PlaySound(SoundConst.SHOT);

        sound.Volume = 0.6f;
    }
コード例 #2
0
    //--------------------------------------------------------------------------

    private void StopSpeeding()
    {
        if (speedingSound)
        {
            speedingSound.AnimateFade(0.5f, true);
            speedingSound = null;
        }
    }
コード例 #3
0
    private void PlaySoundRotate()
    {
        string soundName = currentRotationIndex == 0 ? SoundConst.ROTATE1 : SoundConst.ROTATE2;
        SoundPlaybackController sound = SoundPlayer.Instance.PlaySound(soundName);

        sound.Volume         = 0.80f;
        currentRotationIndex = (currentRotationIndex + 1) % 2;
    }
コード例 #4
0
    //--------------------------------------------------------------------------

    private void PlayFastMusic()
    {
        if (backgroundMusicSlow)
        {
            backgroundMusicSlow.Pause();
        }

        backgroundMusicFast        = SoundPlayer.Instance.PlaySound(SoundConst.BACKGROUND_MUSIC_RUSH);
        backgroundMusicFast.Volume = 1.0f;
        backgroundMusicFast.Loop();
    }
コード例 #5
0
    //--------------------------------------------------------------------------

    public void Play()
    {
        if (Time.time - lastPlayTime > resetDuration)
        {
            currentIndex = startIndex;
        }

        currentIndex = Mathf.Max(Mathf.Min(endIndex, currentIndex), startIndex);

        string soundToPlay            = System.String.Format("{1}{0:00}", currentIndex, soundName);
        SoundPlaybackController sound = SoundPlayer.Instance.PlaySound(soundToPlay);

        sound.Volume = volume;

        currentIndex++;
        lastPlayTime = Time.time;
    }
コード例 #6
0
    //--------------------------------------------------------------------------

    private void PlaySlowMusic()
    {
        if (!backgroundMusicSlow)
        {
            backgroundMusicSlow        = SoundPlayer.Instance.PlaySound(SoundConst.BACKGROUND_MUSIC_SLOW);
            backgroundMusicSlow.Volume = 1.0f;
            backgroundMusicSlow.Loop();
        }
        else
        {
            if (backgroundMusicFast)
            {
                backgroundMusicFast.AnimateFade(0.3f, true);
                backgroundMusicFast = null;
            }
            backgroundMusicSlow.Play();
        }
    }
コード例 #7
0
    //**************************************************************************
    // Playback

    public SoundPlaybackController PlaySound(AudioClip clip)
    {
        GameObject go = new GameObject("Sound [" + clip.name + "]");

        go.transform.parent   = transform;
        go.transform.position = Vector3.zero;

        AudioSource source = go.AddComponent <AudioSource>();

        source.clip = clip;
        source.Play();

        SoundPlaybackController controller = go.AddComponent <SoundPlaybackController>();

        controller.DieAfterTime(Time.realtimeSinceStartup + clip.length);

        return(controller);
    }
コード例 #8
0
    //--------------------------------------------------------------------------

    private void PlaySpeeding()
    {
        StopSpeeding();
        speedingSound        = SoundPlayer.Instance.PlaySound(SoundConst.SPEEDING);
        speedingSound.Volume = 0.70f;
    }
コード例 #9
0
    //--------------------------------------------------------------------------

    private void PlaySoundMoveRight()
    {
        SoundPlaybackController sound = SoundPlayer.Instance.PlaySound(SoundConst.MOVE_RIGHT);

        sound.Volume = 0.55f;
    }