Ejemplo n.º 1
0
        public void OnBlockDrag(CameraManager.CameraEvent camera)
        {
            var point = camera.point + _deltaDistance;

            point.x = Mathf.Floor(point.x);
            point.z = Mathf.Floor(point.z);

            if (Input.GetKeyDown(KeyCode.R))
            {
                transform.rotation = Quaternion.Euler(0, 90, 0);
            }

            if (point != transform.localPosition)
            {
                SetPosition(new Vector3(Mathf.Floor(point.x), transform.localScale.y / 2, Mathf.Floor(point.z)));
                bool canPlace = InPlacablePosition();
                if (canPlace)
                {
                    UIinfo.selectionUIInstance.SetGridColor(SelectionUIObject.PlaceState.CanPlace);
                }
                else
                {
                    UIinfo.selectionUIInstance.SetGridColor(SelectionUIObject.PlaceState.CanNotPlace);
                }

                AudioManager.Instance.PlaySound(AudioClipPath.ItemEffect.Block_Move);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Drag
 /// </summary>
 /// <param name="camera"></param>
 public void OnBlockDrag(CameraManager.CameraEvent camera)
 {
     if (_dragBlock != null)
     {
         _dragBlock.OnBlockDrag(camera);
     }
 }
Ejemplo n.º 3
0
 public void OnBlockAreaEnter(CameraManager.CameraEvent camera)
 {
     _currentEnterBlock = camera.blockBase;
     if (_currentEnterBlock != null)
     {
         _currentEnterBlock.SetBlockAreaEnter(true);
     }
 }
Ejemplo n.º 4
0
 public void OnBlockAreaExit(CameraManager.CameraEvent camera)
 {
     if (_currentEnterBlock != null && camera.blockBase == null)
     {
         FunctionBlockBase temp = _currentEnterBlock;
         _currentEnterBlock = null;
         temp.SetBlockAreaEnter(false);
     }
 }
Ejemplo n.º 5
0
 public void OnGroundSelect(CameraManager.CameraEvent camera)
 {
     if (selectBlock != null)
     {
         FunctionBlockBase temp = selectBlock;
         selectBlock = null;
         temp.SetSelect(false);
     }
 }
Ejemplo n.º 6
0
        public void OnBlockSelect(CameraManager.CameraEvent camera)
        {
            var block = camera.blockBase;

            if (selectBlock != null)
            {
                selectBlock.SetSelect(false);
            }
            selectBlock = block;
            block.SetSelect(true);
        }
Ejemplo n.º 7
0
        public void OnBlockDragEnd(CameraManager.CameraEvent camera)
        {
            bool canPlace = InPlacablePosition();

            if (canPlace)
            {
                if (UIinfo.selectionUIInstance != null)
                {
                    UIinfo.selectionUIInstance.ShowGrid(false);
                }

                GridManager.Instance.UpdateFunctionBlockNodes(this, GridManager.Action.ADD);

                AudioManager.Instance.PlaySound(AudioClipPath.ItemEffect.Block_Place);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Move Block
        /// </summary>
        public void OnBlockDragStart(CameraManager.CameraEvent camera)
        {
            _deltaDistance = GetPosition() - camera.point;
            GridManager.Instance.UpdateFunctionBlockNodes(this, GridManager.Action.REMOVE);

            bool canPlace = InPlacablePosition();

            if (canPlace)
            {
                if (UIinfo.selectionUIInstance != null)
                {
                    UIinfo.selectionUIInstance.ShowGrid(true);
                }
                _oldPosition = GetPosition();
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Drag Start
 /// </summary>
 /// <param name="camera"></param>
 public void OnBlockDragStart(CameraManager.CameraEvent camera)
 {
     _dragBlock = camera.blockBase;
     _dragBlock.OnBlockDragStart(camera);
 }