Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     state = HeroGlowState.hidden;
     mat   = this.GetComponent <Renderer> ().material;
     mat.SetColor("_Tint", new Color(0, 0, 0, 0));
     opacity = 0.0f;
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (state == HeroGlowState.growing)
        {
            opacity += speed * Time.deltaTime;
            if (opacity > 1.0f)
            {
                opacity = 1.0f;
                state   = HeroGlowState.shrinking;
            }
        }
        else if (state == HeroGlowState.shrinking)
        {
            opacity -= speed * Time.deltaTime;
            if (opacity < 0.0f)
            {
                opacity = 0.0f;
                state   = HeroGlowState.hidden;
            }
        }

        this.transform.localScale = new Vector3(opacity * scale, opacity * scale, opacity * scale);
        mat.SetColor("_Tint", new Color(0, 0, 0, opacity));
    }
Exemplo n.º 3
0
 public void glow()
 {
     state = HeroGlowState.growing;
 }