Esempio n. 1
0
 public void SetLightColor(Color Col)
 {
     if (OType == CObjectType.LightObj)
     {
         LightColor = Col;
         LObj       = gameObject.GetComponent <Light>();
         if (LObj != null)
         {
             LObj.color = Col;
         }
     }
     else if ((OType == CObjectType.GroupObj) || (OType == CObjectType.AnimationObj))
     {
         for (int i = 0; i < gameObject.transform.childCount; i++)
         {
             if (gameObject.transform.GetChild(i).name.Contains("light"))
             {
                 ObjectAttrib Oa = gameObject.transform.GetChild(i).GetComponent <ObjectAttrib>();
                 if (Oa != null)
                 {
                     Oa.LightColor = Col;
                     LObj          = gameObject.transform.GetChild(i).GetComponent <Light>();
                     if (LObj != null)
                     {
                         LObj.color = Col;
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
    public void SetLightSize()
    {
        if (OType == CObjectType.LightObj)
        {
            LightSize += 1.0f;
            if (LightSize > 10.0f)
            {
                LightSize = 1.0f;
            }

            LObj = gameObject.GetComponent <Light>();

            if (LObj != null)
            {
                LObj.range = LightSize;
            }
        }
        else if ((OType == CObjectType.GroupObj) || (OType == CObjectType.AnimationObj))
        {
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                if (gameObject.transform.GetChild(i).name.Contains("light"))
                {
                    ObjectAttrib Oa = gameObject.transform.GetChild(i).GetComponent <ObjectAttrib>();
                    if (Oa != null)
                    {
                        Oa.LightSize += 1.0f;
                        if (Oa.LightSize > 10.0f)
                        {
                            Oa.LightSize = 1.0f;
                        }

                        LObj = gameObject.transform.GetChild(i).GetComponent <Light>();

                        if (LObj != null)
                        {
                            LObj.range = Oa.LightSize;
                        }
                    }
                }
            }
        }
    }
Esempio n. 3
0
    public void PublishEdit()
    {
        IsPublish = true;

        for (int i = 0; i < gameObject.transform.childCount; i++)
        {
            if (gameObject.transform.GetChild(i).name.Contains("collision"))
            {
                gameObject.GetComponent <MeshCollider>().sharedMesh = gameObject.transform.GetChild(i).GetComponent <MeshFilter>().sharedMesh;
                gameObject.transform.GetChild(i).gameObject.GetComponent <Renderer>().enabled = false;
            }
            else
            {
                ObjectAttrib Oa = gameObject.transform.GetChild(i).GetComponent <ObjectAttrib>();
                if (Oa != null)
                {
                    Oa.PublishEdit();
                }
            }
        }
    }
Esempio n. 4
0
    public Color GetLightColor()
    {
        if (OType == CObjectType.LightObj)
        {
            return(LightColor);
        }
        else if ((OType == CObjectType.GroupObj) || (OType == CObjectType.AnimationObj))
        {
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                if (gameObject.transform.GetChild(i).name.Contains("light"))
                {
                    ObjectAttrib Oa = gameObject.transform.GetChild(i).GetComponent <ObjectAttrib>();
                    if (Oa != null)
                    {
                        return(Oa.LightColor);
                    }
                }
            }
        }

        return(new Color(1f, 1f, 1f, 1f));
    }