Ejemplo n.º 1
0
 public void ResetReadyToMove()
 {
     isReadyToMove        = false;
     pileNodeCubeMove     = null;
     pushNextNodeCubeMove = null;
     IsMovingUpDown       = false;
 }
Ejemplo n.º 2
0
 public void ResetReadyToMove()
 {
     Debug.Log("RESETELEVATOR");
     isReadyToMove        = false;
     pileNodeCubeMove     = null;
     pushNextNodeCubeMove = null;
     IsMovingUpDown       = false;
 }
Ejemplo n.º 3
0
 public void ResetReadyToMove()
 {
     isReadyToMove        = false;
     pileNodeCubeMove     = null;
     pushNextNodeCubeMove = null;
     isOverNothing        = false;
     isMovingAndSTFU      = false;
 }
        //__
        void PCInput()
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (_KUBRotation.instance.isTurning == false)
                {
                    rayPC = _InGameCamera.instance.NormalCam.ScreenPointToRay(Input.mousePosition);

                    inputPosition = Input.mousePosition;

                    if (Physics.Raycast(rayPC, out aimingHit))
                    {
                        if (aimingHit.collider.gameObject.GetComponent <_CubeMove>() == true)
                        {
                            cubeMove = aimingHit.collider.gameObject.GetComponent <_CubeMove>();

                            if (cubeMove.isSelectable == true)
                            {
                                cubeMove.isSeletedNow = true;
                                cubeMove.GetBasePoint();
                                cubeMove.AddOutline(true);
                                audioSource.Play();
                            }
                            else
                            {
                                cubeMove.SetupCantMoveSound();
                                cubeMove.AddOutline(false);
                            }
                        }
                    }
                    else
                    {
                        _InGameCamera.instance.isCameraMove = true;
                    }
                }
            }
            else if (Input.GetMouseButton(0))
            {
                inputPosition = Input.mousePosition;
                if (cubeMove != null && cubeMove.isSelectable == true)
                {
                    cubeMove.NextDirection();
                }
            }
            else if (Input.GetMouseButtonUp(0))
            {
                _InGameCamera.instance.isCameraMove           = false;
                _InGameCamera.instance.SetupCameraPcInputBool = false;
                if (cubeMove != null)
                {
                    EndSwipe.Invoke();
                    cubeMove.isSeletedNow = false;
                    cubeMove = null;
                }
            }
        }
Ejemplo n.º 5
0
        void PhoneInput()
        {
            if (Input.touchCount == 1)
            {
                touch         = Input.GetTouch(0);
                inputPosition = touch.position;

                rayTouch = _InGameCamera.instance.cam.ScreenPointToRay(touch.position);
                // Handle finger movements based on TouchPhase
                switch (touch.phase)
                {
                //When a touch has first been detected, change the message and record the starting position
                case TouchPhase.Began:

                    if (Physics.Raycast(rayTouch, out aimingHit))
                    {
                        if (aimingHit.collider.gameObject.GetComponent <_CubeMove>() == true)
                        {
                            cubeMove = aimingHit.collider.gameObject.GetComponent <_CubeMove>();

                            if (cubeMove.isSelectable == true)
                            {
                                cubeMove.isSeletedNow = true;
                                cubeMove.GetBasePoint();
                                cubeMove.AddOutline();
                            }
                        }
                    }



                    break;

                case TouchPhase.Moved:
                    //EMouv.Invoke();
                    inputPosition = touch.position;
                    if (cubeMove != null && cubeMove.isSelectable == true)
                    {
                        cubeMove.NextDirection();
                    }

                    break;

                case TouchPhase.Ended:
                {
                    EndSwipe.Invoke();
                    cubeMove.isSeletedNow = false;
                    cubeMove = null;
                }
                break;
                }
            }
        }
Ejemplo n.º 6
0
        public void CheckPileMove(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;
                Debug.Log("---CheckPileMove--- indexTargetNode = " + indexTargetNode + " || myIndex = " + myIndex);

                switch (grid.kuboGrid[indexTargetNode].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    Debug.Log("STUCK-PILE ");
                    soloPileTarget = grid.kuboGrid[myIndex - 1];
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    Debug.Log("EMPTY-PILE " + (indexTargetNode - 1));

                    isReadyToMove  = true;
                    soloPileTarget = grid.kuboGrid[myIndex - 1 + nodeDirection];
                    Debug.Log("EMPTY-PILE-CAN-MOVE ");

                    if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                    {
                        Debug.Log("PILE-AGAIN ");
                        pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                        pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                    }

                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    Debug.Log("MOVE-PILE + indexTargetNode = " + indexTargetNode + " || INDEX = " + (myIndex + nodeDirection));
                    CheckPileMove(indexTargetNode, nodeDirection);
                }
                break;
                }
            }
            else
            {
                Debug.Log("MATRIX LIMIT PILE");
                soloPileTarget = grid.kuboGrid[myIndex - 1];
                isCheckingMove = false;
            }
        }
Ejemplo n.º 7
0
        public void CheckPileMove(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;


                switch (grid.kuboGrid[indexTargetNode].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    soloPileTarget = grid.kuboGrid[myIndex - 1];
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    isReadyToMove  = true;
                    soloPileTarget = grid.kuboGrid[myIndex - 1 + nodeDirection];


                    if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                    {
                        Debug.Log("TEST1");
                        pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                        Debug.Log("TEST 2 = " + pileNodeCubeMove);
                        pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                    }

                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    CheckPileMove(indexTargetNode, nodeDirection);
                }
                break;
                }
            }
            else
            {
                soloPileTarget = grid.kuboGrid[myIndex - 1];
                isCheckingMove = false;
            }
        }
Ejemplo n.º 8
0
        void GoingDownCheck(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;
                Debug.Log("---CheckSoloMoveELEVATOR-GoingDownCheck-- | " + nodeDirection);

                switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    Debug.Log("GoingDownCheck STUCKELEVATOR ");
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    Debug.Log("GoingDownCheck EMPTYELEVATOR ");

                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();

                    Debug.Log("GoingDownCheck DETECT MOVE UP / DOWN");
                    pushNextNodeCubeMove.soloMoveTarget = grid.kuboGrid[indexTargetNode - 1 - nodeDirection];
                    _DataManager.instance.StartMoving.AddListener(pushNextNodeCubeMove.MoveToTarget);
                    pushNextNodeCubeMove.isReadyToMove = true;
                    cubeMoveUpDown.Add(pushNextNodeCubeMove);

                    GoingDownCheck(indexTargetNode, nodeDirection);
                    cubeIsStillInPlace = true;
                }
                break;
                }
            }
            else
            {
                Debug.Log("MATRIX LIMIT SOLOELEVATOR");
                isCheckingMove = false;
            }
        }
Ejemplo n.º 9
0
        void GoingDownCheck(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;


                switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();


                    pushNextNodeCubeMove.soloMoveTarget = grid.kuboGrid[indexTargetNode - 1 - nodeDirection];
                    _DataManager.instance.StartMoving.AddListener(pushNextNodeCubeMove.MoveToTarget);
                    pushNextNodeCubeMove.isReadyToMove = true;
                    cubeMoveUpDown.Add(pushNextNodeCubeMove);

                    GoingDownCheck(indexTargetNode, nodeDirection);
                    cubeIsStillInPlace = true;
                }
                break;
                }
            }
            else
            {
                isCheckingMove = false;
            }
        }
Ejemplo n.º 10
0
        //__
        void PCInput()
        {
            if (Input.GetMouseButtonDown(0))
            {
                rayPC = _InGameCamera.instance.cam.ScreenPointToRay(Input.mousePosition);

                inputPosition = Input.mousePosition;

                if (Physics.Raycast(rayPC, out aimingHit))
                {
                    if (aimingHit.collider.gameObject.GetComponent <_CubeMove>() == true)
                    {
                        cubeMove = aimingHit.collider.gameObject.GetComponent <_CubeMove>();

                        if (cubeMove.isSelectable == true)
                        {
                            cubeMove.isSeletedNow = true;
                            cubeMove.GetBasePoint();
                            cubeMove.AddOutline();
                        }
                    }
                }
            }
            else if (Input.GetMouseButton(0))
            {
                inputPosition = Input.mousePosition;
                if (cubeMove != null && cubeMove.isSelectable == true)
                {
                    cubeMove.NextDirection();
                }
            }
            else if (Input.GetMouseButtonUp(0))
            {
                EndSwipe.Invoke();
                cubeMove.isSeletedNow = false;
                cubeMove = null;
            }
        }
Ejemplo n.º 11
0
        // Start is called before the first frame update

        public void GameSet()
        {
            #region LIST VERSION
            baseCubeArray  = new List <_CubeBase>();
            moveCubeArray  = new List <_CubeMove>();
            elevatorsArray = new List <ElevatorCube>();

            baseCube  = new List <_CubeBase>();
            moveCube  = new List <_CubeMove>();
            elevators = new List <ElevatorCube>();

            foreach (var item in _Grid.instance.kuboGrid)
            {
                if (item.cubeOnPosition != null)
                {
                    _CubeBase    baseCube     = item.cubeOnPosition.gameObject.GetComponent <_CubeBase>();
                    _CubeMove    cubeMove     = item.cubeOnPosition.gameObject.GetComponent <_CubeMove>();
                    ElevatorCube elevatorCube = item.cubeOnPosition.gameObject.GetComponent <ElevatorCube>();

                    if (cubeMove != null)
                    {
                        moveCubeArray.Add(cubeMove);
                    }

                    if (baseCube != null)
                    {
                        baseCubeArray.Add(baseCube);
                    }

                    if (elevatorCube != null)
                    {
                        elevatorsArray.Add(elevatorCube);
                    }
                }
            }
            #endregion

            #region ARRAY VERSION

            /*elevators.Clear();
             * moveCube.Clear();
             * baseCube.Clear();
             *
             * Array.Clear(moveCubeArray, 0, moveCubeArray.Length);
             * Array.Clear(baseCubeArray, 0, baseCubeArray.Length);
             * Array.Clear(elevatorsArray, 0, elevatorsArray.Length);
             *
             * moveCubeArray = FindObjectsOfType<_CubeMove>(); // TODO : DEGEULASSE
             * baseCubeArray = FindObjectsOfType<_CubeBase>();
             * elevatorsArray = FindObjectsOfType<ElevatorCube>(); */
            #endregion


            foreach (ElevatorCube elevator in elevatorsArray)
            {
                elevators.Add(elevator);
            }

            foreach (_CubeMove cube in moveCubeArray)
            {
                moveCube.Add(cube);
            }

            foreach (_CubeBase cube in baseCubeArray)
            {
                baseCube.Add(cube);
            }
        }
Ejemplo n.º 12
0
        public void CheckSoloMove(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;
                Debug.Log("---CheckSoloMoveELEVATOR--- | " + nodeDirection);

                switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    Debug.Log("STUCKELEVATOR ");
                    soloMoveTarget = grid.kuboGrid[myIndex - 1];
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    Debug.Log("EMPTYELEVATOR ");

                    if (nodeDirection == _DirectionCustom.up)
                    {
                        Debug.Log("CAN MOVE UP");
                        isReadyToMove  = true;
                        IsMovingUpDown = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];

                        isCheckingMove = false;
                    }
                    else if (nodeDirection == _DirectionCustom.down)
                    {
                        Debug.Log("CAN MOVE DOWN");
                        isReadyToMove  = true;
                        IsMovingUpDown = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];
                        GoingDownCheck(myIndex, -nodeDirection);
                    }
                    else
                    {
                        isReadyToMove  = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];
                        if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                        {
                            pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                            pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                        }
                        Debug.Log("EMPTY-CAN MOVE-ELEVATOR");

                        isCheckingMove = false;
                    }
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();

                    if (nodeDirection == _DirectionCustom.up || nodeDirection == _DirectionCustom.down)
                    {
                        Debug.Log("DETECT MOVE UP / DOWN");
                        pushNextNodeCubeMove.soloMoveTarget = grid.kuboGrid[indexTargetNode - 1 + nodeDirection];
                        _DataManager.instance.StartMoving.AddListener(pushNextNodeCubeMove.MoveToTarget);
                        pushNextNodeCubeMove.isReadyToMove = true;
                        cubeMoveUpDown.Add(pushNextNodeCubeMove);
                    }
                    else
                    {
                        if (pushNextNodeCubeMove.isReadyToMove == false)
                        {
                            /*if (grid.kuboGrid[indexTargetNode + nodeDirection - 1].cubeLayers == CubeLayers.cubeEmpty && grid.kuboGrid[indexTargetNode + nodeDirection + _DirectionCustom.down - 1].cubeLayers == CubeLayers.cubeEmpty)
                             * {
                             *  Debug.Log("OVER NOTHING");
                             *  pushNextNodeCubeMove.isOverNothing = true;
                             * }
                             * else if(!MatrixLimitCalcul(indexTargetNode, nodeDirection))
                             * {
                             *  Debug.Log("OUSIDE");
                             *  pushNextNodeCubeMove.isOutside = true;
                             * }*/

                            Debug.Log("APPLY DIRECTION " + nodeDirection);
                            pushNextNodeCubeMove.isReadyToMove   = true;
                            pushNextNodeCubeMove.isMovingAndSTFU = true;
                            pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                        }
                    }
                    CheckSoloMove(indexTargetNode, nodeDirection);
                }
                break;
                }
            }
            else
            {
                isOutside         = true;
                outsideMoveTarget = outsideCoord(myIndex, -nodeDirection);
                Debug.Log("MATRIX LIMIT SOLOELEVATOR");
                isCheckingMove = false;
            }
        }
Ejemplo n.º 13
0
        public void CheckSoloMove(int index, int nodeDirection)
        {
            if (MatrixLimitCalcul(index, nodeDirection))
            {
                indexTargetNode = index + nodeDirection;


                switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                {
                case CubeLayers.cubeFull:
                {
                    soloMoveTarget = grid.kuboGrid[myIndex - 1];
                    isCheckingMove = false;
                }
                break;

                case CubeLayers.cubeEmpty:
                {
                    if (nodeDirection == _DirectionCustom.up)
                    {
                        isReadyToMove  = true;
                        IsMovingUpDown = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];

                        isCheckingMove = false;
                    }
                    else if (nodeDirection == _DirectionCustom.down)
                    {
                        isReadyToMove  = true;
                        IsMovingUpDown = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];
                        GoingDownCheck(myIndex, -nodeDirection);
                    }
                    else
                    {
                        isReadyToMove  = true;
                        soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];
                        if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                        {
                            pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                            pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                        }


                        isCheckingMove = false;
                    }
                }
                break;

                case CubeLayers.cubeMoveable:
                {
                    pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();

                    if (nodeDirection == _DirectionCustom.up || nodeDirection == _DirectionCustom.down)
                    {
                        pushNextNodeCubeMove.soloMoveTarget = grid.kuboGrid[indexTargetNode - 1 + nodeDirection];
                        _DataManager.instance.StartMoving.AddListener(pushNextNodeCubeMove.MoveToTarget);
                        pushNextNodeCubeMove.isReadyToMove = true;
                        cubeMoveUpDown.Add(pushNextNodeCubeMove);
                    }
                    else
                    {
                        if (pushNextNodeCubeMove.isReadyToMove == false)
                        {
                            pushNextNodeCubeMove.isReadyToMove   = true;
                            pushNextNodeCubeMove.isMovingAndSTFU = true;
                            pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                        }
                    }
                    CheckSoloMove(indexTargetNode, nodeDirection);
                }
                break;
                }
            }
            else
            {
                isOutside         = true;
                outsideMoveTarget = outsideCoord(myIndex, -nodeDirection);

                isCheckingMove = false;
            }
        }
Ejemplo n.º 14
0
        public void CheckSoloMove(int index, int nodeDirection)
        {
            if (isMovingAndSTFU == false)
            {
                if (MatrixLimitCalcul(index, nodeDirection))
                {
                    indexTargetNode = index + nodeDirection;
                    Debug.Log("---CheckSoloMove--- | " + nodeDirection);

                    switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                    {
                    case CubeLayers.cubeFull:
                    {
                        Debug.Log("STUCK ");
                        soloMoveTarget = grid.kuboGrid[myIndex - 1];
                        isCheckingMove = false;
                    }
                    break;

                    case CubeLayers.cubeEmpty:
                    {
                        Debug.Log("EMPTY ");

                        if (grid.kuboGrid[indexTargetNode - 1 + _DirectionCustom.down].cubeLayers == CubeLayers.cubeMoveable || grid.kuboGrid[indexTargetNode - 1 + _DirectionCustom.down].cubeLayers == CubeLayers.cubeFull)
                        {
                            isReadyToMove  = true;
                            soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];
                            Debug.Log("TAAAAAAAREGT MOVE " + soloMoveTarget.nodeIndex + " ||MyIndex " + myIndex);

                            if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                            {
                                pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                                pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                            }
                            Debug.Log("EMPTY-CAN MOVE-");
                        }
                        else
                        {
                            isReadyToMove = true;
                            Debug.Log("EMPTY-CANNOT MOVE-");
                            soloMoveTarget = grid.kuboGrid[myIndex - 1];
                        }
                        isCheckingMove = false;
                    }
                    break;

                    case CubeLayers.cubeMoveable:
                    {
                        Debug.Log("MOVE ");
                        pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();
                        if (pushNextNodeCubeMove.isReadyToMove == false)
                        {
                            pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                        }
                        CheckSoloMove(indexTargetNode, nodeDirection);
                    }
                    break;
                    }
                }
                else
                {
                    Debug.Log("MATRIX LIMIT SOLO");
                    soloMoveTarget = grid.kuboGrid[myIndex - 1];
                    isCheckingMove = false;
                }
            }
            else
            {
                if (MatrixLimitCalcul(index, nodeDirection))
                {
                    indexTargetNode = index + nodeDirection;
                    Debug.Log("---CheckSoloMove--- | " + nodeDirection + " || index : " + index);

                    switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                    {
                    case CubeLayers.cubeFull:
                    {
                        Debug.Log("STUCK ");
                        soloMoveTarget = grid.kuboGrid[myIndex - 1];
                        isCheckingMove = false;
                    }
                    break;

                    case CubeLayers.cubeEmpty:
                    {
                        isReadyToMove  = true;
                        soloMoveTarget = grid.kuboGrid[index + nodeDirection - 1];

                        Debug.Log("EMPTY " + soloMoveTarget.nodeIndex);

                        if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                        {
                            pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                            pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                        }
                        Debug.Log("EMPTY-CAN MOVE-");

                        isCheckingMove = false;
                    }
                    break;

                    case CubeLayers.cubeMoveable:
                    {
                        Debug.Log("MOVE ");
                        pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();
                        if (pushNextNodeCubeMove.isReadyToMove == false)
                        {
                            pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                        }
                        CheckSoloMove(indexTargetNode, nodeDirection);
                    }
                    break;
                    }
                }
                else
                {
                    Debug.Log("MATRIX LIMIT SOLO");
                    moveOutsideTargetCustomVector = outsideCoord(myIndex, -nodeDirection);
                    isOutside      = true;
                    isCheckingMove = false;
                }
            }
        }
Ejemplo n.º 15
0
        public void CheckSoloMove(int index, int nodeDirection)
        {
            if (isFalling == false)
            {
                if (isMovingAndSTFU == false)
                {
                    if (MatrixLimitCalcul(index, nodeDirection))
                    {
                        indexTargetNode = index + nodeDirection;


                        switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                        {
                        case CubeLayers.cubeFull:
                        {
                            soloMoveTarget = grid.kuboGrid[myIndex - 1];
                            isCheckingMove = false;
                        }
                        break;

                        case CubeLayers.cubeEmpty:
                        {
                            if (grid.kuboGrid[indexTargetNode - 1 + _DirectionCustom.down].cubeLayers == CubeLayers.cubeMoveable || grid.kuboGrid[indexTargetNode - 1 + _DirectionCustom.down].cubeLayers == CubeLayers.cubeFull)
                            {
                                isReadyToMove  = true;
                                soloMoveTarget = grid.kuboGrid[myIndex + nodeDirection - 1];


                                movingToPos = true;

                                if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                                {
                                    pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                                    pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                                }
                            }
                            else
                            {
                                isReadyToMove = true;

                                soloMoveTarget = grid.kuboGrid[myIndex - 1];
                            }
                            isCheckingMove = false;
                        }
                        break;

                        case CubeLayers.cubeMoveable:
                        {
                            pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();
                            if (pushNextNodeCubeMove.isReadyToMove == false)
                            {
                                pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                            }
                            CheckSoloMove(indexTargetNode, nodeDirection);
                        }
                        break;
                        }
                    }
                    else
                    {
                        soloMoveTarget = grid.kuboGrid[myIndex - 1];
                        isCheckingMove = false;
                    }
                }
                else
                {
                    if (MatrixLimitCalcul(index, nodeDirection))
                    {
                        indexTargetNode = index + nodeDirection;


                        switch (grid.kuboGrid[indexTargetNode - 1].cubeLayers)
                        {
                        case CubeLayers.cubeFull:
                        {
                            soloMoveTarget = grid.kuboGrid[myIndex - 1];
                            isCheckingMove = false;
                        }
                        break;

                        case CubeLayers.cubeEmpty:
                        {
                            isReadyToMove  = true;
                            soloMoveTarget = grid.kuboGrid[index + nodeDirection - 1];



                            if (grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeLayers == CubeLayers.cubeMoveable && MatrixLimitCalcul(myIndex, _DirectionCustom.up))
                            {
                                pileNodeCubeMove = grid.kuboGrid[myIndex - 1 + _DirectionCustom.up].cubeOnPosition.GetComponent <_CubeMove>();
                                pileNodeCubeMove.CheckingPile(pileNodeCubeMove.myIndex - 1, nodeDirection);
                            }


                            isCheckingMove = false;
                        }
                        break;

                        case CubeLayers.cubeMoveable:
                        {
                            pushNextNodeCubeMove = grid.kuboGrid[indexTargetNode - 1].cubeOnPosition.GetComponent <_CubeMove>();
                            if (pushNextNodeCubeMove.isReadyToMove == false)
                            {
                                pushNextNodeCubeMove.CheckingMove(indexTargetNode, nodeDirection);
                            }
                            CheckSoloMove(indexTargetNode, nodeDirection);
                        }
                        break;
                        }
                    }
                    else
                    {
                        moveOutsideTargetCustomVector = outsideCoord(myIndex, -nodeDirection);
                        isOutside      = true;
                        isCheckingMove = false;
                    }
                }
            }
        }