saraaaaras / Redo-YYY-New

0 stars 0 forks source link

State management #3

Open PCRedHot opened 1 year ago

PCRedHot commented 1 year ago

https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L83-L89

  1. Do not use the current colour of the button to save the state of your game, it is very dangerous. Check State Management. image
  2. You don't even need to store the state, the Button Object itself should have stored it, search documentation (keywords like enable, enabled, disable)
PCRedHot commented 1 year ago

https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L192

You see, you used it before. Btw, {} here is redundant.

PCRedHot commented 1 year ago

https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L272-L281

Although it seems like a minor problem here, its the same concept, state management. https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L278 should be changed to

bonusText.text = eachConditionResult[14].ToString();
PCRedHot commented 1 year ago

https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L339 https://github.com/saraaaaras/Redo-YYY-New/blob/7d2da933fc6a144d62eb12a0f94cc54c3e474cad/Assets/Inport/script/GameEngine.cs#L343