博文

目前显示的是 四月, 2024的博文

Part: Shop System

Question: After the item is purchased by the store, the button displayed is still use, and the purchase can be repeated Solution: Needs to be detected. If the item has been unlocked, return directly in the registration event of the button, and do not execute the subsequent deduction code. For a better understanding, the button needs to be hidden to indicate that it is unlocked.

Part:Shop System

Shops sell catching tools and food: Use list to store them and initialize them. When the player buys the corresponding item, the corresponding bool value is set to true. When using the corresponding item, it needs to detect whether it is unlocked. If it is unlocked, it can be used normally, otherwise, the subsequent code will not be executed to achieve the restricted use. Question: The order in the list collection is not clear when archiving, resulting in archiving confusion Solution: Comment the code and set the event correctly in the button in the scene. Make the point of the game useful, and the coherence of the game is improved.

Part: Filling System

图片
Reconstruct archive information, Using this class as the data for a single cat, all cats are stored in a list set, replacing the previous archive information for all cats with the SaveCat data type. In this way, the information of the cat in the start game, operating room, return screen, minigame end screen and minigame is fully stored. Ensure the fluency and rationality of the game. Added automatic archiving function, when the cat information changes, the previous manual archiving method is called. Prevents players from forgetting to save resulting in loss of game data. Solution: The class can be parsed and stored by [System.Serializable].

Part: Filing System

Perfect cat archive with cat's name, community number, weight, number of teeth, pregnancy, gender information Question: PlayerPrefs can only archive simple data types, not classes

Part: Minigame 3

Random speed creation, using the random.rangef method provided by unity to create a random speed (within a certain range) every time the slider is reset. Question: Random speed is sometimes too slow or too fast. Solution: Limit the range value of random velocity.

Part:Minigame 3

Add color to the game's sliders, the bottom layer is red, the top layer is green, and when the sliders move to the bottom, they appear all red, telling the player the danger. Question: The speed of the slider is not random and the gameplay is poor.

Part:Minigame 3

图片
Make a slider to indicate the progress. When the slider is at the end, if the mouse is still pressed, the game will fail. When the hand touches the cat, the game will succeed, and the corresponding UI will pop up to refresh the cat's information. Question: The second time to play, because the data is not reset, resulting in a normal game Solution: Write a method to reset the game data, and call it once when shutting down the game, to reset the data, and ensure that the game can run indefinitely. Test feedback: The slider has no color representation, which is not visually obvious and has low playability

Part:Minigame 3

Based on the idea during the demo, I decided to continue making green light red light games. I tried to build the game scene with existing materials.