Ejemplo n.º 1
0
    IEnumerator HologramVisible()
    {
        var   curve = new AnimationCurve();
        float start = 0f, mid = .1f, end = .2f;

        curve.AddMultipleKeys(new Keyframe(start, 0), new Keyframe(mid, 1), new Keyframe(end, 0));

        var elapsed = 0f;

        var inst = new WaitForFixedUpdate();

        while (elapsed <= end)
        {
            _rend.material.SetFloat("_HologramOpacity", curve.Evaluate(elapsed));

            yield return(inst);

            elapsed += Time.fixedDeltaTime;
        }
    }
Ejemplo n.º 2
0
    IEnumerator HologramVisible(Vector3 hitPos)
    {
        var   curve = new AnimationCurve();
        float start = 0f, mid = .1f, end = .2f;

        curve.AddMultipleKeys(new Keyframe(start, 0), new Keyframe(mid, 1), new Keyframe(end, 0));

        var elapsed = 0f;

        var inst = new WaitForFixedUpdate();

        _rend.material.SetVector("_HitPosition", transform.InverseTransformPoint(hitPos));
        var hitTime = end;

        while (elapsed <= end)
        {
            _rend.material.SetFloat("_HologramOpacity", curve.Evaluate(elapsed));
            _rend.material.SetFloat("_HitTime", hitTime);
            yield return(inst);

            hitTime -= Time.fixedDeltaTime;
            elapsed += Time.fixedDeltaTime;
        }
    }