示例#1
0
    private void OnDirectionInput(Vector2Int direction)
    {
        Level level = GameManager.instance.Level;

        if (level != null)
        {
            Character = level.ChosenCharacter;
            if (Character != null && !level.Win)
            {
                Vector3Int worldDirection = GroundPlane.CameraRelativeDirectionToWorldCardinalDirection(
                    new Vector3(direction.x, 0.0f, direction.y),
                    GameManager.instance.Camera);
                if (Character.TryMove(worldDirection))
                {
                    level.CommitToUndoHistory();
                }
            }
        }
    }