obsidian/笔记文件/2.笔记/判断颜色的逻辑和消除.md
2025-03-26 00:02:56 +08:00

78 lines
1.8 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.

这里是判断颜色的逻辑是通过item物体名字来判断的
用到了元组,可以参考[[csharp中的 Tuple]]
![[Pasted image 20230718140222.png]]
需要注意,这里选择的.net版本会影响使用的语法形式
![[Pasted image 20230718140527.png]]
然后调用就是四个方向的调用逻辑了
![[Pasted image 20230718140913.png]]
主要区别是在于本体x和y的增减
![[Pasted image 20230718140948.png]]
![[Pasted image 20230718140957.png]]
![[Pasted image 20230718141151.png]]
![[Pasted image 20230718141158.png]]
判定之后,这里就是相同颜色的四个方向的数组数据
![[Pasted image 20230718141222.png]]
然后,判断是否可以消除的业务逻辑,在这里,也是根据数组长度判定
需要注意的是,这里是特殊的消除逻辑,是对应了不同特效的
![[Pasted image 20230718141325.png]]
![[Pasted image 20230718141333.png]]
![[Pasted image 20230718141340.png]]
判定是否同色的相关逻辑是通过元组的Item1和Item2进行相关操作
![[Pasted image 20230718141809.png]]
这里加上相关的颜色判定系统
![[Pasted image 20230718142027.png]]
这里用数量判断的入口
改布尔为true触发判定系统逻辑
![[Pasted image 20230718144936.png]]
消除响应系统是这个:
![[Pasted image 20230718150714.png]]
还是跟前面判断的逻辑一致,通过数量长度
![[Pasted image 20230718150831.png]]
符合条件就布尔设置为true
![[Pasted image 20230718150858.png]]
对应的是这个:
![[Pasted image 20230718150924.png]]
也是一个事件对应也会触发GameItemView里面的这个
![[Pasted image 20230718150954.png]]
消除逻辑系统也加上
![[Pasted image 20230718151131.png]]
运行是可以消除的
![[Pasted image 20230718151226.png]]