Ejemplo n.º 1
0
    /// <summary>
    /// Lerp the emission and light intensity on the status indicator
    /// </summary>
    /// <param name="endEmissionIntensity"></param>
    /// <param name="endLightIntensity"></param>
    /// <param name="duration"></param>
    /// <returns></returns>
    public IEnumerator LerpStatusIndicatorEmission(float endEmissionIntensity, float endLightIntensity, float duration)
    {
        // Get the current emission and light intensity
        Vector4 startColor = itemEmissiveIndicator.material.GetColor("_EmissionColor");
        float   currentEmissionIntensity = Mathf.Log(startColor.x * (1f / 0.7490196f), 2);
        float   currentLightIntensity    = statusIndicatorLight.intensity;

        // Lerp the emission intensity
        for (float t = 0; t < 1; t += Time.deltaTime / duration)
        {
            itemEmissiveIndicator.material.SetColor("_EmissionColor", GetHDRcolor.GetColorInHDR(defaultStatusColor, Mathf.Lerp(currentEmissionIntensity, endEmissionIntensity, t)));
            statusIndicatorLight.intensity = Mathf.Lerp(currentLightIntensity, endLightIntensity, t);
            yield return(null);
        }

        itemEmissiveIndicator.material.SetColor("_EmissionColor", GetHDRcolor.GetColorInHDR(defaultStatusColor, endEmissionIntensity));
        lerpStatusIndicatorEmissionCoroutine = null;
    }
Ejemplo n.º 2
0
    ///// <summary>
    ///// Vibrates the controller when the player receives the reflected echo
    ///// </summary>
    //public void ReceivedReflectedEcho()
    //{
    //    //print("receive reflected echo");
    //    //GamePad.SetVibration(playerIndex, reflectedEchoHapticStrength, reflectedEchoHapticStrength);
    //    StartCoroutine(AddEchoVibration(reflectedEchoHapticStrength, reflectedEchoHapticDuration));
    //}

    /// <summary>
    /// Vibrates the controller when the player receives the reflected echo
    /// </summary>
    public void ReceivedReflectedEcho()
    {
        //print("receive reflected echo");
        //GamePad.SetVibration(playerIndex, reflectedEchoHapticStrength, reflectedEchoHapticStrength);
        canCreateEcho = true; // Allow the player to create new echo when the previous one returns

        // Change the echo indicator's colors
        Vector4 emissionColor = canCreateEchoColor;

        echoIndicator.GetComponent <MeshRenderer>().material.color = emissionColor;
        echoIndicator.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", GetHDRcolor.GetColorInHDR(emissionColor, echoIndicatorEmissionIntensity));
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Change the emissive color on the indicator
    /// </summary>
    /// <param name="newColor"></param>
    /// <param name="emissionIntensity"></param>
    public void ChangeIndicatorColor(Color newColor, float emissionIntensity)
    {
        // Change Albedo color
        itemStatusIndicator.materials[itemStatusIndicatorMaterialIndex].color = newColor;
        // Change emissive color
        itemStatusIndicator.materials[itemStatusIndicatorMaterialIndex].SetColor("_EmissionColor", GetHDRcolor.GetColorInHDR(newColor, statusIndicatorOnEmissionIntensity));

        // If the player dropped the item, then set emission color to default
        if (newColor == Color.black)
        {
            itemStatusIndicator.materials[itemStatusIndicatorMaterialIndex].SetColor("_EmissionColor", GetHDRcolor.GetColorInHDR(defaultStatusColor, statusIndicatorOnEmissionIntensity));
        }
    }