Пример #1
0
#pragma warning disable CS0472
    void handle_effect(EffectJSON effect)
    {
        if (effect.awkward != null)
        {
            awkward += effect.awkward;
        }

        if (effect.tension != null)
        {
            if (effect.tension < 0)
            {
                effect.tension *= 2; // extra backoff
            }
            tension += effect.tension;
            tension  = Mathf.Max(tension, -0.5f); //tension can't go too far below 0
            resolution_this_event -= effect.tension;
            Debug.Log("Tension is now " + tension.ToString());
        }
        // The result of the expression is always the same since a value of this type is never equal to 'null'
        if (effect.resolution != null)
        {
            // The result of the expression is always the same since a value of this type is never equal to 'null'
            resolution += effect.resolution;
            if (resolution > 0)
            {
                tension = -0.5f; //reset tension
            }
            resolution_this_event += effect.resolution;
            Debug.Log("Resolution is now " + resolution.ToString());
        }
    }
Пример #2
0
#pragma warning disable CS0472
    void handle_effect(EffectJSON effect)
    {
        if (effect.awkward != null)
        {
            awkward += effect.awkward;
            if (effect.awkward > 0)
            {
                resolution -= 0.1f;
            }
            else if (effect.awkward < 0)
            {
                resolution += 0.1f;
            }
        }

        if (effect.tension != null)
        {
            tension += effect.tension;
            tension  = Mathf.Max(tension, 0);
            if (effect.tension > 0)
            {
                resolution -= effect.tension / 2;
            }
            else if (effect.tension < 0)
            {
                resolution += 0.2f;
                tension     = tension / 2;
            }
            resolution_this_event -= effect.tension;
            Debug.Log("Tension is now " + tension.ToString());
        }
        // The result of the expression is always the same since a value of this type is never equal to 'null'
        if (effect.resolution != null)
        {
            // The result of the expression is always the same since a value of this type is never equal to 'null'
            resolution += (2 * effect.resolution);
            if (resolution > 0)
            {
                tension = 0f; //reset tension
            }
            resolution_this_event += (2 * effect.resolution);
            Debug.Log("Resolution is now " + resolution.ToString());
        }
    }