Ejemplo n.º 1
0
    protected virtual void Awake()
    {
        GUICollider[] components = base.gameObject.GetComponents <GUICollider>();
        if (components.Length > 1)
        {
            global::Debug.LogError(base.gameObject.name + "=multi bind GUICollider!!");
        }
        this.boxCollider = base.gameObject.GetComponent <BoxCollider>();
        this.originalPos = base.gameObject.transform.localPosition;
        GUIManager.AddCollider(this);
        this._UISprite = base.gameObject.GetComponent <UISprite>();
        MeshRenderer component = base.gameObject.GetComponent <MeshRenderer>();

        if (this._UISprite != null)
        {
            this.firstColor = this._UISprite.color;
        }
        else if (component != null)
        {
            this.firstColor = component.material.color;
        }
        if (this.touchBehavior == GUICollider.TouchBehavior.BoundAnime && null == this.boundAnime)
        {
            this.boundAnime = base.gameObject.GetComponent <Animation>();
            if (null == this.boundAnime)
            {
                this.boundAnime = base.gameObject.AddComponent <Animation>();
            }
            this.boundAnime.playAutomatically = false;
            if (null == GUICollider.boundAnimeClip)
            {
                GUICollider.boundAnimeClip = (Resources.Load("CommonUI/Animation/ButtonTest") as AnimationClip);
            }
            this.boundAnime.AddClip(GUICollider.boundAnimeClip, GUICollider.boundAnimeClip.name);
        }
        this.originalScale.x = base.gameObject.transform.localScale.x;
        this.originalScale.y = base.gameObject.transform.localScale.y;
        this.originalScale.z = base.gameObject.transform.localScale.z;
    }