public void Explore() { if (!isExplored && canExplore) { isExplored = true; campPlaceholder.SetActive(true); campPlaceholder.GetComponent <MeshRenderer>().material = camp_empty; myCard = deck.Draw(); mesh.material = deck.GetMaterialFromID(myCard.GetMaterialNumber()); TerrainStorage.UnlockTerrain(myCard.GetTerrain()); //Spawn Hunting Cards /* * int amountOfBeasts = myCard.GetNumberOfAnimals(); * var huntingDeck = FindObjectOfType<Hunting_Deck>(); * for (int i = 0; i < amountOfBeasts; i++) * { * huntingDeck.GetBeastFromBeastDeck(); * } * * //Spawn Discovery Tokens * int amountOfTokens = myCard.GetNumberOfDiscoveryTokens(); * var discoveryDeck = FindObjectOfType<DiscoveryToken_Stash>(); * for(int i = 0; i < amountOfTokens; i++) * { * //Spawn Tokens * }*/ } }
public bool IsBuildable() { if (TerrainStorage.GetValue(TerrainType.Beach)) { return(true); } return(false); }
public bool IsBuildable() { if (TerrainStorage.GetValue(IslandCards.TerrainType.River)) { return(true); } return(false); }
public bool IsBuildable() { if (InventionStorage.IsAvailable(Invention.Fire) && TerrainStorage.GetValue(TerrainType.Hill)) { return(true); } return(false); }
// Start is called before the first frame update void Start() { //TODO: Initialize all the other stuff Roof.SetStartValue(0); Wall.SetStartState(0); WeaponPower.SetStartValue(0); Fur.SetStartValue(0); Wood.SetStartValue(0); FoodStorage.SetStartValue(0, 0); Moral.SetStartValue(); TerrainStorage.CreateStorageSpace(); InventionStorage.CreateStorageSpace(); }
private void UploadVisParamTexture(TerrainStorage.Terrain terrain, int offsetX, int offsetY) { byte[] param = new byte[this.Width * this.Height * 4]; ParallelHelper.For2D(this.Width, this.Height, (x, y, i) => { var ii = i * 4; int ti = terrain.C(x + offsetX, y + offsetY); param[ii + 0] = (byte)(terrain.Map[ti].Loose * 8.0f).Clamp(0f, 255f); param[ii + 1] = (byte)(terrain.Map[ti].MovingWater * 8192.0f).Clamp(0f, 255f); param[ii + 2] = (byte)(terrain.Map[ti].Carrying * 32.0f).Clamp(0f, 255f); param[ii + 3] = (byte)(terrain.Map[ti].Erosion * 0.25f).Clamp(0f, 255f); }); this.ParamTexture.Upload(param); }
private void UploadHeightTextureFromTerrain(TerrainStorage.Terrain terrain, int offsetX, int offsetY) { float[] height = new float[this.Width * this.Height]; ParallelHelper.For2D(this.Width, this.Height, (x, y, i) => { height[i] = terrain.Map[terrain.C(x + offsetX, y + offsetY)].Height; }); UploadHeightTexture(height); }
private void CalculateAndUploadNormalsFromTerrain(TerrainStorage.Terrain terrain, int offsetX, int offsetY) { byte[] normals = new byte[this.Width * this.Height * 4]; ParallelHelper.For2D(this.Width, this.Height, (x, y, i) => { var n = terrain.GetNormalFromWHeight(x + offsetX, y + offsetY); var ii = i * 4; normals[ii + 0] = n.X.UnitToByte(); normals[ii + 1] = n.Y.UnitToByte(); normals[ii + 2] = n.Z.UnitToByte(); normals[ii + 3] = 0; }); this.NormalTexture.Upload(normals); }
public void SetDataFromTerrainGeneration(TerrainStorage.Terrain terrain, int offsetX, int offsetY) { SetHeightRange(terrain.Map.Select(c => c.Height).Min(), terrain.Map.Select(c => c.Height).Max()); // height from cells UploadHeightTextureFromTerrain(terrain, offsetX, offsetY); // param texture - cell components UploadVisParamTexture(terrain, offsetX, offsetY); }
public void SetDataFromTerrain(TerrainStorage.Terrain terrain, int offsetX, int offsetY) { SetHeightRange(terrain.Map.Select(c => c.Height).Min(), terrain.Map.Select(c => c.Height).Max()); // height from cells UploadHeightTextureFromTerrain(terrain, offsetX, offsetY); // calculate normals on the fly - for visualisation of generation, this will be done in the vertex shader. CalculateAndUploadNormalsFromTerrain(terrain, offsetX, offsetY); // shade texture - blank for generation vis, AO/shadowmap/scattermap otherwise byte[] shade = new byte[this.Width * this.Height * 4]; this.ShadeTexture.Upload(shade); // param texture - cell components UploadVisParamTexture(terrain, offsetX, offsetY); }
public void OnEnable() { terrain = (TerrainStorage)target; }
public void SetDataFromTerrain(TerrainStorage.Terrain terrain) { if (terrain.Width != this.Width || terrain.Height != this.Height) { throw new InvalidOperationException("Terrain sizes do not match"); } UploadHeightTextureFromTerrain(terrain); }