void Start() { // Note that setting the size of polygon to zero will result in zero vectors. // Since the polygon class's resizing logic uses vertices' normalized vectors, // setting it to zero will permanetly disable future resizing. polygon = GetComponent <OutlinedPolygon>(); polygon.UpdateInnerSize(0.0001f); polygon.UpdateOuterSize(0.0001f); }
void Update() { life += Time.deltaTime; var outerSize = Math.Min(maxSize, size * (float)Math.Log10(life * speed + 1.0)); polygon.UpdateOuterSize(outerSize); polygon.UpdateInnerSize(outerSize * (1.0f - (float)Math.Pow(0.8, life * speed))); // Start fading out when the amount of life left is less then vanishLimit // Before this point, the polygon will not be transparent if (maxLife - life <= vanishLimit) { polygon.UpdateAlpha((maxLife - life) / vanishLimit); if (life >= maxLife) { Destroy(gameObject); } } }
void Update() { currentRadius += (targetRadius - currentRadius) * lerpSpeed; polygon.UpdateOuterSize(currentRadius + borderThickness); polygon.UpdateInnerSize(currentRadius); }
private void Start() { polygon = GetComponent <OutlinedPolygon>(); polygon.UpdateInnerSize(size); polygon.UpdateOuterSize(size + borderThickness); }