Beispiel #1
0
    void OnMarioDiedByGumba(ref GameObject mario)
    {
        if (gumbaDamaged)
        {
            return;
        }

        if (gumbaKilledMario)
        {
            return;
        }
        //set new mario state
        mario.GetComponent <Mario>().SetAnimatorState(Mario.E_ANIM_STATE.DIE);
        mario.GetComponent <Mario>().isDeath = true;
        mario.GetComponent <Mario>().SetVelocity(new Vector2(0, 0));
        //set shader
        camShader.SetMaterial(CameraShader.E_CAM_MATERIAL_ID.GLITCHED, 0.05f);
        GetComponent <SpriteRenderer>().sprite = null;
        StartCoroutine(ResetMap(3f));
        //create sound
        if (!isGumbaTouchedAudioSpawn)
        {
            audioManager.CreateFreeAudioObject(AudioManager.E_AUDIO_ID.GUMBA_TOUCHED);
            isGumbaTouchedAudioSpawn = true;
        }
        gumbaKilledMario = true;
    }
Beispiel #2
0
    public void SetRandomCameraShader()
    {
        switch (Random.Range(0, 30))
        {
        case 1: cameraShader.SetMaterial(CameraShader.E_CAM_MATERIAL_ID.GLITCHED, 999f); break;

        case 2: cameraShader.SetMaterial(CameraShader.E_CAM_MATERIAL_ID.NOCTURNO, 999f); break;

        case 3:
        case 4:
        case 5: cameraShader.SetMaterial(CameraShader.E_CAM_MATERIAL_ID.TAN, 999f); break;
        }
    }
Beispiel #3
0
 void OnMarioTouchedPoison(ref GameObject mario)
 {
     //set new mario state
     mario.GetComponent <Mario>().SetAnimatorState(Mario.E_ANIM_STATE.DIE);
     mario.GetComponent <Mario>().isDeath = true;
     mario.GetComponent <Mario>().SetVelocity(new Vector2(0, 0));
     //set shader
     CameraShader.E_CAM_MATERIAL_ID camShaderID = (CameraShader.E_CAM_MATERIAL_ID)Random.Range(0, (int)CameraShader.E_CAM_MATERIAL_ID.SIZE);
     cameraShader.SetMaterial(camShaderID, 0.2f);
     //hide mushroom becouse if we destroy it, we can't call StartRoutine();
     GetComponent <SpriteRenderer>().sprite = null;
     StartCoroutine(ResetMap(3f));
     //create sound
     if (!isGreenSoundCreated)
     {
         audioManager.CreateFreeAudioObject(AudioManager.E_AUDIO_ID.MUSHROOM_GREEN);
         isGreenSoundCreated = true;
     }
 }
    void OnMarioCollisionHandler()
    {
        float marioPosX       = mario.transform.position.x;
        float glitchAreaWidth = GetComponent <SpriteRenderer>().bounds.size.x;
        float glitchAreaPosX  = transform.position.x;

        audioSource.pitch += (Random.Range(0, 2) == 0) ? 0.015f : -0.01f;
        audioSource.pitch  = (audioSource.pitch > maxPitch) ? minPitch : audioSource.pitch;

        if (marioPosX > glitchAreaPosX - glitchAreaWidth / 2 && marioPosX < glitchAreaPosX + glitchAreaWidth / 2)
        {
            if (!marioAlreadyCollided)
            {
                mapManager.MusicThemePlaying.GetComponent <AudioSource>().pitch -= 0.5f;
            }
            marioAlreadyCollided = true;
            camShader.SetMaterial(CameraShader.E_CAM_MATERIAL_ID.GLITCHED, 0.18f);
            Play();
        }
        else
        {
            Pause();
        }
    }