Created
October 27, 2013 01:09
-
-
Save NTaylorMullen/7176727 to your computer and use it in GitHub Desktop.
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using System.Web; | |
using Microsoft.AspNet.SignalR; | |
namespace DryRunDemo | |
{ | |
public class GameHub : Hub | |
{ | |
static MyGame game = new MyGame(); | |
public override Task OnConnected() | |
{ | |
game.UserManager.NewUser(Context); | |
return base.OnConnected(); | |
} | |
public void Move(string direction, bool startMoving) | |
{ | |
var user = game.UserManager[Context]; | |
switch (direction) | |
{ | |
case "Left": | |
user.Moving.Left = startMoving; | |
break; | |
case "Right": | |
user.Moving.Right = startMoving; | |
break; | |
case "Up": | |
user.Moving.Up = startMoving; | |
break; | |
case "Down": | |
user.Moving.Down = startMoving; | |
break; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment