void Update() { if (Game == null) { Game = Locator.Get <GridiaGame>(); //InitTabbedGui(); Game.Initialize(GridiaConstants.Size, GridiaConstants.Depth, GridiaConstants.SectorSize); // :( GameInitWaitHandle.Set(); } if (Game.View.Focus == null) { return; } if (Game.StateMachine != null) { Game.StateMachine.Step(Time.deltaTime); } Game.View.Render(); for (int i = 0; i < Game.Animations.Count; i++) { var animation = Game.Animations[i]; if (animation.Dead) { Game.Animations.RemoveAt(i); } else { animation.Step(Time.deltaTime); } } ResizeCamera(); // :( only on resize }
public static void Connect(String ip, int port) { if (GridiaConstants.ErrorMessage != null || connecting) { return; } Debug.Log("Connecting to server ..."); var game = new GridiaGame(); try { _conn = new ConnectionToGridiaServerHandler(ip, port, game); Locator.Provide(game); Locator.Provide(_conn); new Thread(() => { try { Debug.Log("Starting connection ..."); connecting = true; _conn.Start(() => Debug.Log("Connection settled!"), _conn); Debug.Log("connection started"); } catch (Exception ex) { connecting = false; Debug.LogError(ex); GridiaConstants.ErrorMessage = "Connection to server has been lost."; GridiaConstants.ErrorMessageAction = () => { GridiaConstants.SoundPlayer.MuteSfx = GridiaConstants.SoundPlayer.MuteMusic = true; SceneManager.LoadScene("ServerSelection"); }; } }).Start(); } catch (SocketException ex) { GridiaConstants.ErrorMessage = "Could not connect to " + ip + " at port " + port; Debug.Log(ex); } }
public TargetSelectState() { _driver = Locator.Get <GridiaDriver>(); _tileMap = Locator.Get <TileMap>(); _game = Locator.Get <GridiaGame>(); }
public ItemMovementState(Vector3 locationOfItemToMove) { LocationOfItemToMove = locationOfItemToMove; _driver = Locator.Get <GridiaDriver>(); _game = Locator.Get <GridiaGame>(); }
// :( public IdleState() { _driver = Locator.Get <GridiaDriver>(); _game = Locator.Get <GridiaGame>(); _game.SelectorDelta = Vector3.zero; }
public ConnectionToGridiaServerHandler(String host, int port, GridiaGame game) { _socketHandler = new FileTransferringSocketReciever(new SocketHandlerImpl(host, port), GridiaConstants.GetFileSystem()); _game = game; }
private Vector3 _destinationSelectorDelta = Vector3.zero; // :( #endregion Fields #region Constructors public ActionLocationPickState(GridiaAction action) { _driver = Locator.Get <GridiaDriver>(); _game = Locator.Get <GridiaGame>(); _action = action; }