示例#1
0
    public void RespawnPlayer()
    {
        playerDead = 0.3f;

        movement.x = 0;
        movement.y = 0;

        direction          = SwipeDirection.None;
        transform.position = new Vector3(0, -11, 0);

        XonixUtils.UpdateAnimator(animator, direction);
    }
示例#2
0
    private void FixedUpdate()
    {
        if (CanMove())
        {
            transform.position = (transform.position + movement * moveSpeed * Time.fixedDeltaTime);
        }
        else
        {
            UpdateMovement();
            XonixUtils.UpdateAnimator(animator, direction);
        }

        if (!TryAtackPlayer())
        {
            TryAtackPlayerTrack();
        }
    }
示例#3
0
    private void UpdateDirection(SwipeDirection swipeDirection)
    {
        if (GameController.isPause)
        {
            return;
        }

        if (IsDirectionConflict(swipeDirection))
        {
            movement.x = 0;
            movement.y = 0;
            direction  = SwipeDirection.None;

            // Decrement player health
            OnPlayerDamaged();
        }
        else
        {
            movement.x = 0;
            movement.y = 0;

            direction = swipeDirection;

            switch (direction)
            {
            case SwipeDirection.Up:
                movement.y = 1;
                break;

            case SwipeDirection.Down:
                movement.y = -1;
                break;

            case SwipeDirection.Left:
                movement.x = -1;
                break;

            case SwipeDirection.Right:
                movement.x = 1;
                break;
            }
        }

        XonixUtils.UpdateAnimator(animator, direction);
    }