public void OnSystemUpdate(float dt) { _commands.Swap(); for (int i = 0; i < _commands.PreviousList.Count; i++) { if (_commands.PreviousList[i] == null) { continue; } if (_commands.PreviousList[i].TryComplete()) { _commands.PreviousList[i].Complete(); _commands.CurrentList.Remove(_commands.PreviousList[i]); } } }
public void Post <T>(T msg) where T : IEntityMessage { MessageReceivers.Swap(); var list = MessageReceivers.PreviousList; for (int i = 0; i < list.Count; i++) { if (list[i] == null) { continue; } (list[i] as IReceiveRef <T>)?.Handle(ref msg); } for (int i = 0; i < list.Count; i++) { if (list[i] == null) { continue; } (list[i] as IReceive <T>)?.Handle(msg); } }
private void UpdatePlayerPosition() { //TODO: this needs to be more global //if (!GameOptions.UseCulling) { // return; //} var playPos = Player.Tr.position.WorldToGenericGrid(_sectorSize); if (playPos == _playerPosition) { return; } _playerPosition = playPos; _list.Swap(); _list.CurrentList.Clear(); _list.CurrentList.Add(_playerPosition); for (int i = 0; i < DirectionsExtensions.DiagonalLength; i++) { var pos = _playerPosition + ((DirectionsEight)i).ToP3(); _list.CurrentList.Add(pos); } SetList(true); SetList(false); }