Unity Creator Kit: Puzzle

4个月前 (01-13) 0 点赞 0 收藏 0 评论 6 已阅读

Creator Kit: Puzzle 资源地址

✅ Get Started with the Creator Kit: Puzzle

新建Unity项目3D | 版本选择 2022.3 或更高 | 导入Creator Kit: Puzzle资源 | 双击 ExampleMenu :

image.png

点play 按钮运行起来:

image.png

✅ Design a Simple Puzzle

In this Creator Kit, you’ll use connectable puzzle pieces to build tracks which are used to guide a marble to a goal. In this tutorial, you’ll:

Set up a new game
Design a ramp system for your puzzle
Test your first level

您将使用可连接的拼图来构建轨道,用于引导弹珠到达目标。

为您的拼图设计一个坡道系统

How to Use the 【Menu】 and 【Level System

➡️ Create a Menu: 顶部菜单 Puzzle Kit Tools > Create Menu:

image.png

点击 Create Menu,就会在这个路径下生成一个新的名为 newMenu 的Scene:

image.png

双击 newMenu 打开场景 | 选中MenuCanvas | 找到它身上的 Scene Menu 脚本:

image.png

设置第一关。
点击Create and Add 按钮 create a new level。

image.png

This will create a default level linked to the menu, which you can customize.

image.png

Give your level a name in the Display Name field.
Total Required Stars : When players complete a level, they earn stars which will allow them to move on to a new one (if this is available). Since players have no stars when they begin, this first level should have a requirement value of 0.
Finally, select times for the three Star Time fields in seconds. The faster players complete a level, the more stars they should receive: your Three Star Time should have the lowest value, and One Star Time the highest.

最后,为三个“Star Time”字段选择时间(以秒为单位)。玩家完成关卡的速度越快,他们应该获得的星星就越多:你的Three Star Time 应该具有最低值,One Star Time 应该具有最高值。

➡️ Open the Layout Editing System

在 Project窗口下,双击刚刚创建的 newLevel 场景:

image.png

select the LevelLayout GameObject | find the PuzzleLayout component

image.png

This will enable you to choose puzzle pieces to use in your level and snap them together.
这将使您能够选择要在关卡中使用的puzzle pieces并将它们组合在一起。

Click the Editing Layout button:

image.png

Click the StraightRampPieces box button. This will show all the straight ramp pieces available to you. 这将显示所有可用的【直坡道】。
Select the sloping straight piece — starting with a slope will help get the marble rolling. 选择倾斜的笔直部分——从斜坡开始将有助于使弹珠滚动。

marble
n. 大理石
(用玻璃、泥等制成的)弹子
弹子游戏

Click in the Scene view to add the piece as a child of the LevelLayout GameObject.

image.png

When you’ve finished adding ramp pieces, click the Editing Layout button again to turn off editing mode. Remember to save your changes! 记得退出编辑模式

As you add more puzzle pieces, especially curved ramps, you may want to change the orientation of a piece. You can use the Flip field buttons to:

image.png

Turn the puzzle piece from left to right using the x-axis button
Turn the puzzle piece back to front using the z-axis button
Flip the puzzle piece upside down using the y-axis button

You can also press 【R】 to change the connector the piece will use to snap to the next one.

➡️ Position the Marble and Goal

select the Marble GameObject.

If the Marble GameObject is not properly aligned to the start of the puzzle, drag on these arrows to move it.
如果 Marble 游戏对象未正确与puzzle的开头对齐,请拖动这些箭头以移动它。

image.png

select the Goal GameObject

Repeat the process to center the view on the Goal, and move it to the end of your puzzle.

image.png

Now you can test the puzzle — click Play in the toolbar to begin. If you get stuck, you can restart the level by pressing the R key.

现在您可以测试puzzle了 —— 在工具栏中点击“播放”开始游戏。如果您卡住了,可以通过按下R键来重新开始该关卡。

✅ Increase the Challenge

In this tutorial, you’ll:

Add more objects to your puzzle
Add more marbles to your puzzle

➡️ Add More 【Prefab Objects】

Assets/Creator Kit - Puzzle/Prefabs/PuzzlePieces 下找到 InteractivePuzzlePieces ,把它下面的 Spoon 拖拽到场景中:

image.png

选中 Spoon 游戏对象,找到它下面的脚本组件:Flipper。

这个 Interact Key 字段作用是指定交互按键:当玩家按下一个键时,所有 InteractivePuzzlePieces 都会被激活。默认是空格键,可以点击下拉菜单更改。

Find the Power slider. This controls the power of the puzzle piece in the game. This has been set to a sensible default, but you can customize this for your puzzle. 控制了游戏中puzzle的力量。这已被设置为合理的默认值,但您可以为您的puzzle自定义它。

You can add as many InteractivePuzzlePieces to your level as you like.

You can also add OtherPuzzlePieces using the same drag and drop process. These pieces don’t need any input from the player.

image.png

➡️ Create Another 【Marble】

You can also add multiple marbles to your levels to create more imaginative puzzles. 您还可以在关卡中添加多个弹珠,以创建更具想象力的谜题。

找到 Assets/Creator Kit - Puzzle/Prefabs/OnePerLevel

image.png

可以在拖拽1个 Marble到场景中,命名为 Marble2:

image.png

To make sure that the Camera can follow different marbles in your level:

select the TargetGroup GameObject
find the Cinemachine Target Group component for the GameObject.

image.png

Go to the Target list at the bottom of the component and click the + button. Then click the circular button to the right of the new item on the list and select the name of your new marble from the drop-down menu.

image.png

Save your changes.

➡️ Start the Level with a Different Marble

When you click Play, the initial marble in the level is frozen in space until the level has finished fading in, at which point the timer starts. If you want your new marble to be the one that starts the game, you need to adjust the Timing GameObject

单击“播放”时,关卡中的初始弹珠将冻结在空间中,直到关卡完成淡入,此时计时器将启动。如果希望新弹珠成为游戏的启动对象,则需要调整 Timing 游戏对象:

click the arrow to the left of the LevelUICanvas GameObject to see its child GameObjects. Select the Timing GameObject.

image.png

find the Timing Recording script component. Click the circular button to the right of the Starting Marble field and select the name of your new marble.

image.png

TIP: You can also use the Timing Recording component to change the key used to 【restart the game】, by selecting a new key in the Reset Key Code field. 可以修改重新启动游戏的Key

➡️ Finish the Level with a Different Marble

If you want your new marble to be the one that triggers level completion, you also need to change the Goal settings:

select the Goal GameObject.
find the Target Trigger component

Click the circular button to the right of the Marble field and select the name of your new marble from the drop-down menu.
Save your changes.

image.png

➡️ Add Multiple Puzzle Layouts to your Level

If you want to really create a challenge, you can also add multiple puzzles to one level. This can be useful if you want to play with 【more advanced designs】. 更高级的设计

Note: As you’ve previously explored, only assigned marbles can start or end the level. If you are using multiple puzzle layouts in one level, check carefully to make sure you have assigned these roles correctly or you may have difficulty playing the level.
正如您之前所探索的,只有指定的弹珠才能开始或结束关卡。如果您在一个关卡中使用多个puzzle布局,请仔细检查以确保您正确分配了这些角色,否则您可能难以玩该关卡。

To add multiple puzzle layouts to your level:

select the LevelLayout GameObject

Right-click on LevelLayout and select Duplicate

Right-click on LevelLayout (1) and select Rename; give the new GameObject a more memorable name.
go to the PuzzleLayout component. You will be able to use this to build you ramp, just as you did for your first layout.

image.png

Save your changes.


Unity Creator Kit: Puzzle

本文收录在
0评论

登录

忘记密码 ?

切换登录

注册