public Mineral GenerateMineral(MineralType t) { Mineral clone = Instantiate(baseMineral, new Vector3(0, 0, 0), baseMineral.transform.rotation) as Mineral; DeformMesh(clone.GetComponent <MeshFilter>().mesh, clone.GetComponent <PolygonCollider2D>(), 4, Random.Range(int.MinValue, int.MaxValue)); clone.renderer.material.SetColor("_OffColor", Asteroid.MineralToColor(t)); clone.renderer.material.SetColor("_Color", Asteroid.MineralToColor(t)); return(clone); }
private void Mine() { mineCount++; rb.transform.position = new Vector3(rb.transform.position.x, rb.transform.position.y + miningDistanceY, rb.transform.position.z + miningDistanceZ); timer = System.DateTimeOffset.Now.ToUnixTimeMilliseconds(); Color col = blockBeingMined.GetComponent <Renderer>().material.color; blockBeingMined.GetComponent <Renderer>().material.color = new Color(col.r, col.g, col.b, col.a - disappearingsRate); }