Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        rect        = this.GetComponent <RectTransform> ();
        raw         = this.GetComponent <RawImage> ();
        elapsedTime = 0.0f;
        Color newColor = new Color(8, 8, 8, 8);

        raw.color = newColor;
        state     = coolDownState.idle;
        dispel    = false;
    }
Exemplo n.º 2
0
 public void dispelEyes()
 {
     if (elapsedTime > cooldownTime)
     {
         dispel      = true;
         elapsedTime = 0.0f;
         flashValue  = 0.0f;
         fader.setFadeValue(1.0f);
         state = coolDownState.flashingIn;
     }
 }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        elapsedTime += Time.deltaTime;
        if (elapsedTime < cooldownTime)
        {
            setFraction(elapsedTime / cooldownTime);
        }
        else
        {
            setFraction(1.0f);
        }

        if (state == coolDownState.flashingIn)
        {
            fader.imageRef.enabled = true;
            fader.setFadeColor(1, 1, 1);
            fader.setFadeValue(flashValue);
            flashValue -= flashSpeed * Time.deltaTime;
            if (flashValue < 0.0)
            {
                flashValue = 0.0f;
                state      = coolDownState.flashingOut;
            }
        }

        if (state == coolDownState.flashingOut)
        {
            fader.setFadeColor(1, 1, 1);
            fader.setFadeValue(flashValue);
            flashValue += flashSpeed * Time.deltaTime;
            if (flashValue > 1.0)
            {
                flashValue = 1.0f;
                setFraction(0);
                fader.setFadeValue(1.0f);
                fader.setFadeColor(0, 0, 0);
                dispel = false;
                state  = coolDownState.idle;
                fader.imageRef.enabled = false;
            }
        }

        if (state == coolDownState.idle)
        {
        }
    }