public void ChangeGroundType(int groundTypeID) { TileData.GroundType groundType = (TileData.GroundType)groundTypeID; _tile = _tileSelector.SelectedTile; _levelChangeHandler.ParseGroundTypeChange(_tile, groundType); }
public GameObject GetParticleEffect(TileData.GroundType groundType) { for (int i = 0; i < _tileEffects.Length; i++) { if (_tileEffects[i].groundType != groundType) { continue; } return(_tileEffects[i].ParticleSystemGameObject); } return(null); }
// we can't serialize dictionaries in scriptable objects, hence we're iterating. public bool HasTileEffects(TileData.GroundType groundType) { for (int i = 0; i < _tileEffects.Length; i++) { if (_tileEffects[i].groundType != groundType) { continue; } return(true); } return(false); }
public void SetGroundType(TileData.GroundType newType) { _tileData.groundType = newType; var tileLibrary = SkinResources.Instance.GetTileLibrary(); _renderer.material = tileLibrary.GetMaterial((int)_tileData.groundType); if (tileEffect != null) { Destroy(tileEffect); } if (tileLibrary.HasTileEffects(_tileData.groundType)) { GameObject effect = tileLibrary.GetParticleEffect(_tileData.groundType); tileEffect = Instantiate(effect, transform); } }
public void ParseGroundTypeChange(Tile tile, TileData.GroundType newGroundType) { string tileReference = String.Concat(tile.ID, "/", DatabaseConstants.GROUNDTYPE); _reference.Child(tileReference).SetValueAsync((int)newGroundType); }