Esempio n. 1
0
    void Update()
    {
        foreach (Process process in Process.processes)
        {
            process.timeRate = 1;
            foreach (TimeSphere timeSphere in TimeSphere.timeSpheres)
            {
                if (timeSphere.active && timeSphere.CollidesWith(process))
                {
                    process.timeRate = timeSphere.timeRate;
                }
            }
        }
        TimeSphere playerIn = null;

        foreach (TimeSphere timeSphere in TimeSphere.timeSpheres)
        {
            if (timeSphere.PlayerInside())
            {
                if (timeSphere.active)
                {
                    playerIn = timeSphere;
                }
            }
        }
        if (playerIn != null)
        {
            MakeTint(playerIn);
            useColor = true;
        }
        else
        {
            useColor = false;
        }
    }
Esempio n. 2
0
    void MakeTint(TimeSphere timeSphere)
    {
        tint = new Texture2D(1, 1);

        Material material     = timeSphere.radiusSphere.GetComponent <MeshRenderer> ().material;
        Color    slowColor    = material.GetColor("_SlowColor");
        Color    neutralColor = material.GetColor("_NeutralColor");
        Color    fastColor    = material.GetColor("_FastColor");

        float maxTimeRate = material.GetFloat("_MaxTimeRate");

        Color colorToUse;

        if (timeSphere.timeRate <= 1)
        {
            colorToUse = LerpColors(slowColor, neutralColor, timeSphere.timeRate);
        }
        else
        {
            colorToUse = LerpColors(neutralColor, fastColor, Mathf.InverseLerp(1, maxTimeRate, timeSphere.timeRate));
        }

        tintColor = colorToUse;
    }