public void ReplaceGameServiceFindObjectService(Game.Service.IFindObjecService newFindObjectService) { var index = ServiceComponentsLookup.GameServiceFindObjectService; var component = (Game.Service.FindObjectServiceComponent)CreateComponent(index, typeof(Game.Service.FindObjectServiceComponent)); component.findObjectService = newFindObjectService; ReplaceComponent(index, component); }
public ServiceEntity SetGameServiceFindObjectService(Game.Service.IFindObjecService newFindObjectService) { if (hasGameServiceFindObjectService) { throw new Entitas.EntitasException("Could not set GameServiceFindObjectService!\n" + this + " already has an entity with Game.Service.FindObjectServiceComponent!", "You should check if the context already has a gameServiceFindObjectServiceEntity before setting it or use context.ReplaceGameServiceFindObjectService()."); } var entity = CreateEntity(); entity.AddGameServiceFindObjectService(newFindObjectService); return(entity); }
public void ReplaceGameServiceFindObjectService(Game.Service.IFindObjecService newFindObjectService) { var entity = gameServiceFindObjectServiceEntity; if (entity == null) { entity = SetGameServiceFindObjectService(newFindObjectService); } else { entity.ReplaceGameServiceFindObjectService(newFindObjectService); } }