public void ReplaceAsset(AssetsEnum newValue) { var index = GameComponentsLookup.Asset; var component = CreateComponent <AssetComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
private void AddAditionalEntityComponents(AssetsEnum selectedAsset, GameObject gameObject, GameEntity entity) { switch (selectedAsset) { case AssetsEnum.Tank: entity.AddTankView(gameObject.GetComponent <TankView>()); break; } }
public GameObject GetPrefab(AssetsEnum asset) { switch (asset) { case AssetsEnum.Tank: return(TankPrefab); case AssetsEnum.Projectile: return(ProjectilePrefab); } throw new Exception("Asset " + asset.ToString() + " not found."); }
private GameObject GetGameObject(AssetsEnum selectedAsset) { switch (selectedAsset) { case AssetsEnum.Tank: return(GameObject.Instantiate(_contexts.game.globals.value.GetPrefab(selectedAsset))); case AssetsEnum.Projectile: return(_contexts.game.projectilePool.value.GetProjectile()); } return(null); }
protected override void Execute(System.Collections.Generic.List <GameEntity> entities) { foreach (var entity in entities) { AssetsEnum selectedAsset = entity.asset.value; GameObject gameObject = GetGameObject(selectedAsset); if (gameObject != null) { AttachGameObjectToEntity(gameObject, entity); AddAditionalEntityComponents(selectedAsset, gameObject, entity); } } }