public void ReplaceBattleConfig(BigBattle.BattleConfig newValue) { var index = ServerComponentsLookup.BattleConfig; var component = (BigBattle.BattleConfigComponent)CreateComponent(index, typeof(BigBattle.BattleConfigComponent)); component.value = newValue; ReplaceComponent(index, component); }
public ServerEntity SetBattleConfig(BigBattle.BattleConfig newValue) { if (hasBattleConfig) { throw new Entitas.EntitasException("Could not set BattleConfig!\n" + this + " already has an entity with BigBattle.BattleConfigComponent!", "You should check if the context already has a battleConfigEntity before setting it or use context.ReplaceBattleConfig()."); } var entity = CreateEntity(); entity.AddBattleConfig(newValue); return(entity); }
public void ReplaceBattleConfig(BigBattle.BattleConfig newValue) { var entity = battleConfigEntity; if (entity == null) { entity = SetBattleConfig(newValue); } else { entity.ReplaceBattleConfig(newValue); } }