public GameService(IWebSocketConnection connection, IComponents components) { this.connection = connection; connection.OnOpen += OnConnectionEstablished; connection.OnClose += OnConnectionClosed; connection.OnError += OnErrorOccurred; connection.OnMessage += OnMessageReceived; id = components.Get <IIdGenerator>().GenerateId(); sessionCollection = components.Get <IWebSocketSessionCollection>(); gameSceneCollection = components.Get <IGameSceneCollection>(); jsonSerializer = new NativeJsonSerializer(); handlerCollection = new MessageHandlerCollection(jsonSerializer); player = new PlayerGameObject(id, new IComponent[] { new AnimationData(), new CharacterData(), new PresenceMapProvider(), new MessageSender(jsonSerializer), new PositionChangedMessageSender(), new AnimationStateChangedMessageSender(), new PlayerAttackedMessageSender(), new BubbleNotificationMessageSender() }); }
protected override void OnAwake() { idGenerator = Components.Get <IIdGenerator>(); gameSceneCollection = Components.Get <IGameSceneCollection>(); gameSceneCollection.Add(Map.Lobby, CreateLobby()); gameSceneCollection.Add(Map.TheDarkForest, CreateTheDarkForest()); }
public ChangeSceneMessageHandler(IGameObject player, IGameSceneCollection gameSceneCollection) { this.gameSceneCollection = gameSceneCollection; proximityChecker = player.Components.Get <IProximityChecker>(); presenceMapProvider = player.Components.Get <IPresenceMapProvider>(); messageSender = player.Components.Get <IMessageSender>(); }
public EnterSceneMessageHandler(IGameObject player, IGameSceneCollection gameSceneCollection) { this.player = player; this.gameSceneCollection = gameSceneCollection; characterData = player.Components.Get <ICharacterData>(); presenceMapProvider = player.Components.Get <IPresenceMapProvider>(); messageSender = player.Components.Get <IMessageSender>(); }