Quantcast
Channel: Latest Questions by haiderInUnity
Viewing all articles
Browse latest Browse all 26

How to seperate/decouple UI and player code

$
0
0
Hi i have 3 buttons each of which set a different projectile for a player to shoot i can have each buttons refer to the player and set the player.projectileToshoot relative to the button pressed...but that couples the UI buttons to the player how can i avoid that...i thought of c# events that whenever i click on the button a event triggers but that too will need reference to player or buttons.. how should i go about doing this? to clearify further I have a playershoot class which just shoots any projectile assigned to it....then i have a button class which is attached to each button...and here a projectile is chosen depending upon the button clicked...now i want that chosen projectile to be set to the playershoot projectile without coupling the UI to the player code

Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>