obsidian/笔记文件/2.笔记/第二关的花.md
2025-03-26 00:02:56 +08:00

57 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

举个栗子,花的预制体
![[Pasted image 20230706173730.png]]
是用了球形的碰撞器
![[Pasted image 20230706173806.png]]
脚本
![[Pasted image 20230706173909.png]]
设定上,第二关是玩家可以唱歌,如果是在花的旁边唱歌,就会开花,然后落泪
开花的布尔,动画控制器,音频
也是直接Resource目录下的资源加载
![[Pasted image 20230706174323.png]]
花对应的动画控制器也很简单
![[Pasted image 20230706174526.png]]
默认是空的
![[Pasted image 20230706174543.png]]
然后是一个开花的动画
![[Pasted image 20230706174602.png]]
玩家唱歌,歌也会是一个有碰撞效果的实体
所以,碰撞函数,如果还没开花布尔,就播放动画
改布尔
播放音频然后协程1.5秒延迟后,创建落泪
![[Pasted image 20230706174638.png]]
有限制了方向的
![[Pasted image 20230706174746.png]]
四元数api
Quaternion.identity默认无旋转
![[Pasted image 20230706174815.png]]
需要注意的是,是有两种类型的花,不过上面挂的组件都是一样的,只是参数不一样
![[Pasted image 20230707143201.png]]
需要注意的是第二关的眼泪预制体TearItem实际上对应的都是花不要被名字误导了
![[Pasted image 20230707151655.png]]