void Start() { theCamera = Object.FindObjectOfType <KeyboardMove>(); minimapTerrainTexture = new Texture2D(map.width, map.depth); for (var x = 0; x < map.width; x += 1) { for (var z = 0; z < map.depth; z += 1) { var height = (float)map.Height(new Game.DVector3(x, 0, z)); if (height < 0) { minimapTerrainTexture.SetPixel(x, z, Color.blue); } else { var shade = Mathf.Clamp01(height / (float)Game.Map.maxHeight); minimapTerrainTexture.SetPixel(x, z, new Color(shade, 0.5f + shade / 2, shade)); } } } minimapTerrainTexture.Apply(); minimapTerrain.texture = minimapTerrainTexture; }
void Start() { // Get the Rigidbody component of this object rb = GetComponent <Rigidbody2D>(); playerScript = GameObject.FindWithTag(targettag).GetComponent <KeyboardMove>(); }