public void ReplaceShipsSetup(ShipsSetup newValue) { var index = GameComponentsLookup.ShipsSetup; var component = CreateComponent <ShipsSetupComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetShipsSetup(ShipsSetup newValue) { if (hasShipsSetup) { throw new Entitas.EntitasException("Could not set ShipsSetup!\n" + this + " already has an entity with ShipsSetupComponent!", "You should check if the context already has a shipsSetupEntity before setting it or use context.ReplaceShipsSetup()."); } var entity = CreateEntity(); entity.AddShipsSetup(newValue); return(entity); }
public void ReplaceShipsSetup(ShipsSetup newValue) { var entity = shipsSetupEntity; if (entity == null) { entity = SetShipsSetup(newValue); } else { entity.ReplaceShipsSetup(newValue); } }