public void ReplaceBattleTime(BattleTimeData newValue) { var index = GameComponentsLookup.BattleTime; var component = (BattleTimeComponent)CreateComponent(index, typeof(BattleTimeComponent)); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetBattleTime(BattleTimeData newValue) { if (hasBattleTime) { throw new Entitas.EntitasException("Could not set BattleTime!\n" + this + " already has an entity with BattleTimeComponent!", "You should check if the context already has a battleTimeEntity before setting it or use context.ReplaceBattleTime()."); } var entity = CreateEntity(); entity.AddBattleTime(newValue); return(entity); }
public void ReplaceBattleTime(BattleTimeData newValue) { var entity = battleTimeEntity; if (entity == null) { entity = SetBattleTime(newValue); } else { entity.ReplaceBattleTime(newValue); } }