public void ReplaceTimeService(svanderweele.Core.Pieces.Time.ITimeService newTime) { var index = MetaComponentsLookup.TimeService; var component = CreateComponent <svanderweele.Core.Pieces.Time.TimeServiceComponent>(index); component.time = newTime; ReplaceComponent(index, component); }
public MetaEntity SetTimeService(svanderweele.Core.Pieces.Time.ITimeService newTime) { if (hasTimeService) { throw new Entitas.EntitasException("Could not set TimeService!\n" + this + " already has an entity with svanderweele.Core.Pieces.Time.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(svanderweele.Core.Pieces.Time.ITimeService newTime) { var entity = timeServiceEntity; if (entity == null) { entity = SetTimeService(newTime); } else { entity.ReplaceTimeService(newTime); } }