public void ReplaceRandom(BigBattle.Random newValue) { var index = ClientComponentsLookup.Random; var component = (BigBattle.RandomComponent)CreateComponent(index, typeof(BigBattle.RandomComponent)); component.value = newValue; ReplaceComponent(index, component); }
public void AddRandom(BigBattle.Random newValue) { var index = ServerComponentsLookup.Random; var component = (BigBattle.RandomComponent)CreateComponent(index, typeof(BigBattle.RandomComponent)); component.value = newValue; AddComponent(index, component); }
public ClientEntity SetRandom(BigBattle.Random newValue) { if (hasRandom) { throw new Entitas.EntitasException("Could not set Random!\n" + this + " already has an entity with BigBattle.RandomComponent!", "You should check if the context already has a randomEntity before setting it or use context.ReplaceRandom()."); } var entity = CreateEntity(); entity.AddRandom(newValue); return(entity); }
public void ReplaceRandom(BigBattle.Random newValue) { var entity = randomEntity; if (entity == null) { entity = SetRandom(newValue); } else { entity.ReplaceRandom(newValue); } }