예제 #1
0
파일: Level11.cs 프로젝트: Fataler/SolveMe
    private void OnSwipe(SwipeListener.SwipeDirection swipeDir)
    {
        switch (swipeDir)
        {
        case (SwipeListener.SwipeDirection.Up):
            arrowUp.Move(new Vector2(0, 1));
            break;

        case (SwipeListener.SwipeDirection.Down):
            arrowDown.Move(new Vector2(0, -1));
            break;

        case (SwipeListener.SwipeDirection.Right):
            arrowRight.Move(new Vector2(1, 0));
            break;
        }
        CheckForRestart();
        CheckForWin();
    }
예제 #2
0
파일: Level23.cs 프로젝트: Fataler/SolveMe
    // Update is called once per frame
    private void RotateGameObject(SwipeListener.SwipeDirection dir, GameObject go)
    {
        switch (dir)
        {
        case SwipeListener.SwipeDirection.Down:
            go.transform.localRotation = Quaternion.AngleAxis(0f, Vector3.forward);
            break;

        case SwipeListener.SwipeDirection.Right:
            go.transform.localRotation = Quaternion.AngleAxis(90f, Vector3.forward);
            break;

        case SwipeListener.SwipeDirection.Left:
            go.transform.localRotation = Quaternion.AngleAxis(-90f, Vector3.forward);
            break;

        case SwipeListener.SwipeDirection.Up:
            go.transform.localRotation = Quaternion.AngleAxis(180f, Vector3.forward);
            break;
        }
    }
예제 #3
0
    private void CheckMove(SwipeListener.SwipeDirection swipeDirection)
    {
        Vector2 moveInput = new Vector2(0, 0);

        switch (swipeDirection)
        {
        case SwipeListener.SwipeDirection.Up:
            moveInput = new Vector2(0, 1);
            break;

        case SwipeListener.SwipeDirection.Down:
            moveInput = new Vector2(0, -1);
            break;

        case SwipeListener.SwipeDirection.Left:
            moveInput = new Vector2(-1, 0);
            break;

        case SwipeListener.SwipeDirection.Right:
            moveInput = new Vector2(1, 0);
            break;
        }
        if (moveInput.sqrMagnitude > 0.5)
        {
            foreach (var player in players)
            {
                player.Move(moveInput);
            }
            foreach (var player in players)
            {
                if (player.blockedByTile)
                {
                    player.Move(moveInput);
                    player.blockedByTile = false;
                }
            }
        }
    }
예제 #4
0
파일: Level23.cs 프로젝트: Fataler/SolveMe
    private void CheckSwipe(SwipeListener.SwipeDirection dir)
    {
        RotateGameObject(dir, frogSprite);

        if (!frog.Move(DirectionVector(dir)))
        {
            if (frog.transform.position == fakeWallPos)
            {
                knockCount--;
                audioSource.PlayOneShot(fakeWallKnock);
            }
            else
            {
                audioSource.PlayOneShot(wallKnock);
            }
        }

        if (knockCount < 0)
        {
            fakeWall.SetActive(false);
        }
        CheckWin();
    }
예제 #5
0
파일: Level23.cs 프로젝트: Fataler/SolveMe
    private Vector2 DirectionVector(SwipeListener.SwipeDirection dir)
    {
        var dirVector = new Vector2(0, 0);

        switch (dir)
        {
        case SwipeListener.SwipeDirection.Down:
            dirVector = Vector2.down;
            break;

        case SwipeListener.SwipeDirection.Right:
            dirVector = Vector2.right;
            break;

        case SwipeListener.SwipeDirection.Left:
            dirVector = Vector2.left;
            break;

        case SwipeListener.SwipeDirection.Up:
            dirVector = Vector2.up;
            break;
        }
        return(dirVector);
    }