/// <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; }
/// <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); }
/// <summary> /// Adds SnakeMoveEvent and FeedEatenEvent listeners. /// </summary> /// <param name="eventController"></param> public void Subscribe(IEventController eventController) { eventController.AddListener <SnakeMoveEvent>(OnSnakeMove); eventController.AddListener <FeedEatenEvent>(OnFeedEaten); }
/// <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; }
/// <summary> /// Set reference to event controller and listener to FeedEatenEvent. /// </summary> public void Subscribe(IEventController eventController) { eventController.AddListener <FeedEatenEvent>(OnFeedEaten); _eventController = eventController; }
/// <summary> /// Adds OnScoreChanged method for listening to event. /// </summary> /// <param name="eventController"></param> public void Subscribe(IEventController eventController) { eventController.AddListener <ScoreChangedEvent>(OnScoreChanged); }