예제 #1
0
        /// <summary>
        /// Unity Mothod
        /// </summary>
        private void Awake()
        {
            ObjectShapeEntity data = new ObjectShapeEntity();

            this.DataEntity = data;
            Watch(this);
        }
예제 #2
0
        /// <summary>
        /// 鼠标拖拽
        /// </summary>
        private void OnMouseDrag()
        {
            Vector3 screenZ = Camera.main.WorldToScreenPoint(transform.position);
            Vector3 world   = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenZ.z));

            ObjectShapeEntity data = (ObjectShapeEntity)DataEntity;

            data.position = world;
        }
예제 #3
0
 /// <summary>
 /// Unity Mothod
 /// </summary>
 protected override void Start()
 {
     base.Start();
     selfColor = GetComponent <MeshRenderer>().material.GetColor("_Color");
     //开始拖拽
     gameObject.SetBeginDrag((p) =>
     {
         ObjectShapeEntity data = (ObjectShapeEntity)DataEntity;
         data.normalColor       = Color.red;
     });
     //结束拖拽
     gameObject.SetEndDrag((p) =>
     {
         ObjectShapeEntity data = (ObjectShapeEntity)DataEntity;
         data.normalColor       = selfColor;
     });
 }