public void ReplaceKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget) { var index = GameComponentsLookup.KittyAmountDisplay; var component = (KittyAmountDisplayComponent)CreateComponent(index, typeof(KittyAmountDisplayComponent)); component.KittyAmountDisplayWidget = newKittyAmountDisplayWidget; ReplaceComponent(index, component); }
public GameEntity SetKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget) { if (hasKittyAmountDisplay) { throw new Entitas.EntitasException("Could not set KittyAmountDisplay!\n" + this + " already has an entity with KittyAmountDisplayComponent!", "You should check if the context already has a kittyAmountDisplayEntity before setting it or use context.ReplaceKittyAmountDisplay()."); } var entity = CreateEntity(); entity.AddKittyAmountDisplay(newKittyAmountDisplayWidget); return(entity); }
public void ReplaceKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget) { var entity = kittyAmountDisplayEntity; if (entity == null) { entity = SetKittyAmountDisplay(newKittyAmountDisplayWidget); } else { entity.ReplaceKittyAmountDisplay(newKittyAmountDisplayWidget); } }