简体   繁体   English

在统一3D中匹配随机数对游戏?

[英]Matching random number pair game in unity 3d?

It's like any matching image game just instead of images we have random numbers. 就像任何匹配的图像游戏一样,它代替的是我们没有随机数的图像。 Need to create matching pair of random number game in an 2*2 matrix such that on clicking the matched pairs it should show you had won the game and it should contain timer within that you have to match the numbers. 需要以2 * 2矩阵创建匹配的随机数字游戏对,以便在单击匹配的配对时应该显示您已经赢了游戏,并且其中必须包含计时器以匹配数字。 It's need to be created via c# scripting in unity 3d? 是否需要通过统一3d中的c#脚本创建?

I'm not going to write the codes for you, instead i'll point you in the direction to go in. 我不会为您编写代码,而是会为您指明方向。

Create a master script that handles the game, things it needs 创建一个处理游戏所需内容的主脚本

  • int Timer 计时器
  • bool isGameOver 布尔isGameOver
  • Random generation between 1 - 4 for where to spawn objects, cannot repeat 1-4之间的随机生成,用于生成对象,不能重复
  • 1 Gameobject to spawn for clicking 产生1个Gameobject以供点击
  • SendMessage on player click to objects 播放器上的SendMessage单击对象
  • Player mouse input commands 播放器鼠标输入命令

Create a gameobject script that handles being clicked. 创建一个用于处理被单击的游戏对象脚本。

  • bool isClicked 布尔isClicked
  • bool isCorrect 布尔是正确的
  • function that is called when clicked. 单击时调用的函数。

That's... about all you need, Good luck. 那就是...关于您所需要的一切,祝您好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM