Example #1
0
    public void Solid(bool add)//实体化
    {
        alpha         = 1;
        isTransparent = false;
        state         = SuperGameManager.States.Show;
        if (m_renderer != null)//如果他有着色器,其实也就代笔他是子物体。。。
        {
            m_transform.gameObject.layer = LayerMask.NameToLayer("Default");
            m_renderer.enabled           = true;
            if (isSelected)    //如果是选中状态,那么绿色高亮显示
            {
                if (cancelDye) //判断是否取消染色,如果是取消染色的状态,那么和没选中的显示情况一样。。。
                {
                    Reset(false);
                }
                else
                {
                    //m_renderer.material = SuperGameManager.Instance.lightning;
                    m_renderer.material.mainTexture = SuperGameManager.Instance.highLightTexture;
                    m_renderer.material.shader      = rootShader;

                    //显示对应线框
                    Block_loadmodel.Instance.SetWireMeshWithName(this.name, true);
                }
            }
            else//如果是非选中状态
            {
                m_renderer.material             = m_Material;
                m_renderer.material.mainTexture = rootTexture;
                m_renderer.material.shader      = rootShader;
                m_renderer.material.color       = rootColor;

                Block_loadmodel.Instance.SetWireMeshWithName(this.name, false);
            }
            if (add)
            {
                if (!SuperGameManager.Instance.objectsInScene.Contains(this))//如果objectsInScene还不包含这个元素,那就加进去
                {
                    SuperGameManager.Instance.objectsInScene.Add(this);
                    SuperGameManager.Instance.objectsInSceneTemp.Add(this);
                }

                if (antagonistic_object != null)//如果这个结构有对应的拮抗体
                {
                    antagonistic_object.Hide(true);
                }
            }
        }
    }
Example #2
0
 public void HideSelected()//隐藏所选
 {
     foreach (Transform obj in selectedObjects)
     {
         TouchableObject tobj = obj.GetComponent <TouchableObject>();
         if (tobj.isSpecial)
         {
             Transform tobjp = obj.parent;
             for (int i = 0; i < tobjp.childCount; i++)
             {
                 tobjp.GetChild(i).GetComponent <TouchableObject>().Hide(false);
             }
         }
         else
         {
             tobj.Hide(false);
         }
     }
 }