public void ReplaceTickService(svanderweele.Core.Pieces.Tick.Services.ITickService newInstance) { var index = MetaComponentsLookup.TickService; var component = CreateComponent <svanderweele.Core.Pieces.Tick.Services.TickServiceComponent>(index); component.instance = newInstance; ReplaceComponent(index, component); }
public MetaEntity SetTickService(svanderweele.Core.Pieces.Tick.Services.ITickService newInstance) { if (hasTickService) { throw new Entitas.EntitasException("Could not set TickService!\n" + this + " already has an entity with svanderweele.Core.Pieces.Tick.Services.TickServiceComponent!", "You should check if the context already has a tickServiceEntity before setting it or use context.ReplaceTickService()."); } var entity = CreateEntity(); entity.AddTickService(newInstance); return(entity); }
public void ReplaceTickService(svanderweele.Core.Pieces.Tick.Services.ITickService newInstance) { var entity = tickServiceEntity; if (entity == null) { entity = SetTickService(newInstance); } else { entity.ReplaceTickService(newInstance); } }