Esempio n. 1
0
 void Awake()
 {
     _theDaystar = Resources.FindObjectsOfTypeAll <TheDaystar> () [0];
     _theHouse   = FindObjectOfType <TheHouse> ();
     _skill      = GetComponent <TheTrueDaystarSkill> ();
     _settings   = FindObjectOfType <Settings> ();
 }
Esempio n. 2
0
 public override void Awake()
 {
     base.Awake();
     _shakeCamera = FindObjectOfType <CameraShake> ();
     _objectShake = GetComponent <ObjectShake> ();
     _theHouse    = FindObjectOfType <TheHouse> ();
     _theHellFire = FindObjectOfType <TheHellFire> ();
 }
Esempio n. 3
0
 public DungeonServer(IPEndPoint endpoint, ILog log)
 {
     _log    = log;
     _house  = new TheHouse();
     _server = ServerBuilder.CreateAsync(endpoint)
               .WithCommand("JOIN").ExpectsData().HandledBy(r => {
         var name   = Encoding.ASCII.GetString(r.Data);
         var player = _house.Join(name);
         _playerConnectionLookup[r.Client] = player;
         _log.Debug("server: '{0}' joined as '{1}'", name, player.Name);
         return(Response.Create("OK").WithData(Encode(name)));
     }).Register()
               .WithCommand("LEAVE").ExpectsNoData().HandledBy(r => {
         var player = _playerConnectionLookup[r.Client];
         _house.Leave(player);
         _log.Debug("server: '{0}' left", player.Name);
         return(Response.Create("OK"));
     }).Register()
               .WithCommand("LISTEN").ExpectsNoData().HandledBy(r => {
         var player = _playerConnectionLookup[r.Client];
         return(Response.Create("OK").WithData(Encode(string.Join("\r\n", player.Listen()))));
     }).Register()
               .WithCommand("LOOK").ExpectsNoData().HandledBy(r => {
         var player = _playerConnectionLookup[r.Client];
         return(Response.Create("OK").WithData(Encode(player.Look())));
     }).Register()
               .WithCommand("LOCATION").ExpectsNoData().HandledBy(r => {
         var player = _playerConnectionLookup[r.Client];
         return(Response.Create("OK").WithData(Encode(player.Location.Name)));
     }).Register()
               .WithCommand("GO").ExpectsNoData().HandledBy(r => {
         var player    = _playerConnectionLookup[r.Client];
         var direction = (Direction)Enum.Parse(typeof(Direction), r.Arguments[0], true);
         return(Response.Create("OK").WithData(Encode(player.Go(direction))));
     }).Register()
               .WithCommand("SAY").ExpectsData().HandledBy(r => {
         var player = _playerConnectionLookup[r.Client];
         player.Say(Encoding.ASCII.GetString(r.Data));
         return(Response.Create("OK"));
     }).Register()
               .OnClientDisconnected((id, ip) => {
         var player = _playerConnectionLookup[ip];
         player.Dispose();
         _playerConnectionLookup.Remove(ip);
     })
               .Build();
     log.Debug("started server on {0}", endpoint);
 }
Esempio n. 4
0
 void Awake()
 {
     _theShepherd = FindObjectOfType <TheShepherd> ();
     _theHouse    = FindObjectOfType <TheHouse> ();
 }
Esempio n. 5
0
 void Awake()
 {
     _execBtn.onClick.AddListener(Execute);
     _theHouse    = GetComponent <TheHouse> ();
     _cameraShake = FindObjectOfType <CameraShake> ();
 }
Esempio n. 6
0
 void Awake()
 {
     _settings = FindObjectOfType <Settings> ();
     _theHouse = FindObjectOfType <TheHouse> ();
 }
Esempio n. 7
0
 void Awake()
 {
     _theHouse = FindObjectOfType <TheHouse> ();
 }