public void ReplaceTimeService(src.libs.src.services.core.time.ITimeService newTime) { var index = MetaComponentsLookup.TimeService; var component = CreateComponent <TimeServiceComponent>(index); component.time = newTime; ReplaceComponent(index, component); }
public MetaEntity SetTimeService(src.libs.src.services.core.time.ITimeService newTime) { if (hasTimeService) { throw new Entitas.EntitasException("Could not set TimeService!\n" + this + " already has an entity with src.libs.src.components.meta.TimeServiceComponent!", "You should check if the context already has a timeServiceEntity before setting it or use context.ReplaceTimeService()."); } var entity = CreateEntity(); entity.AddTimeService(newTime); return(entity); }
public void ReplaceTimeService(src.libs.src.services.core.time.ITimeService newTime) { var entity = timeServiceEntity; if (entity == null) { entity = SetTimeService(newTime); } else { entity.ReplaceTimeService(newTime); } }