public void ReplaceMovableSpriteSettings(MovableSpriteSettings newValue) { var index = GameComponentsLookup.MovableSpriteSettings; var component = (MovableSpriteSettingsComponent)CreateComponent(index, typeof(MovableSpriteSettingsComponent)); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetMovableSpriteSettings(MovableSpriteSettings newValue) { if (hasMovableSpriteSettings) { throw new Entitas.EntitasException("Could not set MovableSpriteSettings!\n" + this + " already has an entity with MovableSpriteSettingsComponent!", "You should check if the context already has a movableSpriteSettingsEntity before setting it or use context.ReplaceMovableSpriteSettings()."); } var entity = CreateEntity(); entity.AddMovableSpriteSettings(newValue); return(entity); }
public void ReplaceMovableSpriteSettings(MovableSpriteSettings newValue) { var entity = movableSpriteSettingsEntity; if (entity == null) { entity = SetMovableSpriteSettings(newValue); } else { entity.ReplaceMovableSpriteSettings(newValue); } }