Quantcast
Channel: Multiplayer
Viewing all articles
Browse latest Browse all 16796

Command pattern in Unet

$
0
0
I currently have a game where I use the command pattern. So every action the player can do is encapsulated as an object, all implement the Command interface.

I now want to send each command over the network. So thought, easy, I just make a method:

Code (CSharp):
  1.  
  2.   [Command]
  3.    void CmdSendCommand(Command command)
  4.    {
  5.      command.Do();
  6.    }
  7.  
But this doesn't work, because you can't have interface-types as parameters. Also note that 'Command' is my interface, while '[Command]' is...

Command pattern in Unet

Viewing all articles
Browse latest Browse all 16796

Trending Articles



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