コード例 #1
0
    public void SetBlend(Roga2dBlendType blendType, float alpha, Roga2dHue hue)
    {
        // If nothing has changed, don't do anything
        if (this.blendType == blendType && this.alpha == alpha && this.hue == hue) {
            return;
        }
        this.blendType = blendType;
        this.alpha = alpha;
        this.hue = hue;

        if (this.material != null) {
            Object.Destroy(this.material);
        }

        if (!hue.IsZero() || alpha != 1.0f || this.material != null) {
            this.renderer.material =  Roga2dResourceManager.getSharedMaterial(this.textureID, blendType);
            if (blendType == Roga2dBlendType.Alpha) {
                this.renderer.material.SetColor("_EmisColor", new Color(hue.r / 255.0f + 0.5f, hue.g / 255.0f + 0.5f, hue.b / 255.0f + 0.5f, alpha));
            } else {
                this.renderer.material.SetColor("_Color", new Color(1.0f, 1.0f, 1.0f, alpha));
            }
            this.material = this.renderer.material;
        } else {
            this.renderer.sharedMaterial =  Roga2dResourceManager.getSharedMaterial(this.textureID, blendType);
        }
    }
コード例 #2
0
    private void Initialize(string name)
    {
        this.children = new List<Roga2dNode>();

        if (this.GameObject == null) {
            this.GameObject = new GameObject(name);
            this.transform = this.GameObject.transform;
        } else {
            this.LocalPosition = this.transform.position;
        }

        this.LocalHue.SetRGB(0, 0, 0);
        this.LocalAlpha = 1.0f;
        this.LocalPriority = 0.0f;
        this.alpha = 1.0f;
        this.hue = new Roga2dHue(0, 0, 0);
        this.priority = -999.0f;
    }
コード例 #3
0
    public void Pop()
    {
        if (this.gameObject == null) {
            this.gameObject = new GameObject("RenderObject");
            this.transform = this.gameObject.transform;

            if (this.texture != null) {
                MeshFilter meshFilter = this.gameObject.AddComponent("MeshFilter") as MeshFilter;
                this.renderer = this.gameObject.AddComponent("MeshRenderer") as MeshRenderer;

                this.alpha = 0.0f;
                this.mesh = GeneratePlane();
                meshFilter.mesh = this.mesh;
                this.SetSize(this.pixelSize);
                this.SetSrcRect(this.srcRect);
                Roga2dHue hue = new Roga2dHue(0, 0, 0);
                this.SetBlend(Roga2dBlendType.Alpha, 1.0f, hue);
            }
        }
    }
コード例 #4
0
 public virtual void UpdateHue()
 {
     if (this.Parent == null) {
         this.hue = this.LocalHue;
     } else {
         this.hue = this.LocalHue + this.Parent.Hue;
     }
 }