Пример #1
0
        /// <summary>
        /// Sets event controller reference and adds events listeners.
        /// </summary>
        public void Subscribe(IEventController eventController)
        {
            eventController.AddListener <SpecialFeedExpiredEvent>(OnSpecialFeedExpired);
            eventController.AddListener <FeedEatenEvent>(OnFeedEaten);
            eventController.AddListener <SnakeMoveEvent>(OnSnakeMoveEvent);

            _eventController = eventController;
        }
Пример #2
0
 /// <summary>
 /// Sets event controller reference and adds event listeners.
 /// </summary>
 public void Subscribe(IEventController eventController)
 {
     _eventController = eventController;
     eventController.AddListener <SnakeTurnCommandEvent>(OnTurnCommand);
     eventController.AddListener <FeedEatenEvent>(OnFeedEaten);
 }
Пример #3
0
 /// <summary>
 /// Adds SnakeMoveEvent and FeedEatenEvent listeners.
 /// </summary>
 /// <param name="eventController"></param>
 public void Subscribe(IEventController eventController)
 {
     eventController.AddListener <SnakeMoveEvent>(OnSnakeMove);
     eventController.AddListener <FeedEatenEvent>(OnFeedEaten);
 }
Пример #4
0
 /// <summary>
 /// Sets _foodSpawningController and event controller reference. Adds SnakeMoveEvent listener.
 /// </summary>
 public void Subscribe(IEventController eventController)
 {
     _foodSpawningController = UnityScene.GetController <GameController>().foodSpawningController;
     eventController.AddListener <SnakeMoveEvent>(OnSnakeMove);
     _eventController = eventController;
 }
Пример #5
0
 /// <summary>
 /// Set reference to event controller and listener to FeedEatenEvent.
 /// </summary>
 public void Subscribe(IEventController eventController)
 {
     eventController.AddListener <FeedEatenEvent>(OnFeedEaten);
     _eventController = eventController;
 }
Пример #6
0
 /// <summary>
 /// Adds OnScoreChanged method for listening to event.
 /// </summary>
 /// <param name="eventController"></param>
 public void Subscribe(IEventController eventController)
 {
     eventController.AddListener <ScoreChangedEvent>(OnScoreChanged);
 }