コード例 #1
0
ファイル: HintsButton.cs プロジェクト: mmmcclel53/Momentum
    public void onHintClick()
    {
        if (MovingObject.getIsMoving() || GameManager.playerHints <= 0)
        {
            return;
        }

        GameManager.playerHints -= 1;
        GameManager.savePlayerDetails();

        if (solution == null)
        {
            solution = LevelManager.solution;
        }

        int movingObjectIndex = Mathf.FloorToInt(Int32.Parse(solution[0]) / 16);

        MovingObject.setObject(movableObjects[movingObjectIndex]);

        Swipe direction = getSwipeDirection(Int32.Parse(solution[0]) % 16);

        MovingObject.setSwipeDirection(direction);

        Vector3 currentPos = MovingObject.getObject().transform.position;
        Vector3 newPos     = swipeManager.calculateNewPosition(currentPos, direction);

        MovingObject.setPosition(newPos);

        MovingObject.setIsMoving(true);

        Move move = new Move(MovingObject.getObject(), direction, currentPos, newPos);

        LevelManager.moves.Add(move);

        solution = solution.Skip(1).ToArray();
    }