- Home /
correct usage class and threads c#
My program consist on a big class that includes several classes (imagine a robot, the main class is "robot" and subclasses are leg1, leg2, arm1, arm2, head...). Every of the subclasses (arm, head...) has it's own socket to receive data, gameobjects attached to them, etc. Every subclass can have 30-40 parameters. We can do things like robot.head.color = Color.green... stuff like that.
My main class (robot) is declared public static, so the sockets access directly to the information of the main class. For example, if I receive the position via a socket, i do:
(from the thread head.socket): robot.head.position = position
Do you think that's correct? How would you do that?
something doesn't look correct there and although it works I've seen the program die a couple times. Doesn't look super reliable.
Your answer
