コード例 #1
0
        /// <summary>
        /// 监视数据模型实体
        /// </summary>
        private void Awake()
        {
            CubeDataModelEntity entity = new CubeDataModelEntity();

            this.DataEntity = entity;
            Watch(this);
        }
コード例 #2
0
        /// <summary>
        /// 更新Undo和Redo按钮状态
        /// </summary>
        private void Update()
        {
            Debug.Log(cubeDataEntity);

            //点击需要删除的物体
            if (Input.GetMouseButton(0))
            {
                //射线检测,点击UI和空白处无反应
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit))
                {
                    if (!EventSystem.current.IsPointerOverGameObject() && hit.collider.name == "Plane")
                    {
                        return;
                    }
                    //碰撞到物体上,返回物体信息
                    else
                    {
                        Debug.Log("砰砰砰");
                        cubeDataModdel = hit.collider.gameObject.GetComponent <CubeDataModel>();
                        cubeDataEntity = (CubeDataModelEntity)cubeDataModdel.DataEntity;

                        Debug.Log(cubeDataEntity);

                        if (cubeDataModdel.gameObject != null)
                        {
                            IsClickedPart = true;
                        }
                    }
                }
            }
        }