public void ReplaceGameServiceTimerService(Game.Service.ITimerService newTimerService) { var index = ServiceComponentsLookup.GameServiceTimerService; var component = (Game.Service.TimerServiceComponent)CreateComponent(index, typeof(Game.Service.TimerServiceComponent)); component.TimerService = newTimerService; ReplaceComponent(index, component); }
public ServiceEntity SetGameServiceTimerService(Game.Service.ITimerService newTimerService) { if (hasGameServiceTimerService) { throw new Entitas.EntitasException("Could not set GameServiceTimerService!\n" + this + " already has an entity with Game.Service.TimerServiceComponent!", "You should check if the context already has a gameServiceTimerServiceEntity before setting it or use context.ReplaceGameServiceTimerService()."); } var entity = CreateEntity(); entity.AddGameServiceTimerService(newTimerService); return(entity); }
public void ReplaceGameServiceTimerService(Game.Service.ITimerService newTimerService) { var entity = gameServiceTimerServiceEntity; if (entity == null) { entity = SetGameServiceTimerService(newTimerService); } else { entity.ReplaceGameServiceTimerService(newTimerService); } }