Last active
June 13, 2017 20:33
-
-
Save dested/e5ec9f49faba73ae51b9ecf43e1ab94b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServerGame : Game | |
{ | |
public override void MakePlayer() | |
{ | |
MainPlayer = new ServerPlayer(); | |
} | |
public void Tick() | |
{ | |
MainPlayer.ServerThing();//Unavailable without casting | |
} | |
} | |
public abstract class Game | |
{ | |
public Player MainPlayer { get; set; } | |
public abstract void MakePlayer(); | |
public void Tick() { } | |
} | |
public class ClientGame : Game | |
{ | |
public override void MakePlayer() | |
{ | |
MainPlayer = new ClientPlayer(); | |
} | |
public void Tick() | |
{ | |
MainPlayer.ClientThing();//Unavailable without casting | |
} | |
} | |
public class ServerPlayer : Player | |
{ | |
public void ServerThing() { } | |
} | |
public abstract class Player | |
{ | |
} | |
public class ClientPlayer : Player | |
{ | |
public void ClientThing() { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment