Ejemplo n.º 1
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!gameObject.activeInHierarchy || !this.enabled)
            {
                return;
            }

            drawer.color = LeapColor.red.WithAlpha(1f);

            var a         = Vector3.zero;
            var b         = Vector3.zero;
            var effRadius = capsuleCollider.GetEffectiveRadius();

            capsuleCollider.GetCapsulePoints(out a, out b);

            drawer.DrawWireCapsule(a, b, effRadius);
            drawer.DrawWireCapsule(a, b, effRadius * 1.01f);
        }
Ejemplo n.º 2
0
        public void drawPingGizmos(RuntimeGizmoDrawer drawer)
        {
            Color      pingColor;
            float      pingSize;
            float      animTime;
            Vector3    pingPos0, pingPos1;
            Quaternion pingRot0;

            foreach (var ping in _activePings)
            {
                if (ping.position0Func != null)
                {
                    pingPos0 = ping.position0Func();
                }
                else
                {
                    pingPos0 = ping.position0;
                }

                if (ping.position1Func != null)
                {
                    pingPos1 = ping.position1Func();
                }
                else
                {
                    pingPos1 = ping.position1;
                }

                pingRot0 = ping.rotation0;

                pingColor = ping.color;

                animTime = Mathf.Lerp(0f, 1f, ping.time / PING_DURATION);
                animTime = pingAnimCurve.Evaluate(animTime);

                pingSize = ping.sizeMultiplier * DEFAULT_PING_RADIUS;

                switch (ping.animType)
                {
                case AnimType.Expand:
                    pingSize = pingSize * animTime;
                    break;

                case AnimType.Fade:
                    pingColor = ping.color.WithAlpha(1f - animTime);
                    break;

                case AnimType.ExpandAndFade:
                    pingSize  = pingSize * animTime;
                    pingColor = ping.color.WithAlpha(1f - animTime);
                    break;
                }


                drawer.color = pingColor;

                switch (ping.shapeType)
                {
                case ShapeType.Sphere:
                    drawer.DrawWireSphere(pingPos0, pingRot0, pingSize);
                    break;

                case ShapeType.Capsule:
                    drawer.DrawWireCapsule(pingPos0, pingPos1, pingSize);
                    break;

                case ShapeType.Cone:
                    drawer.DrawCone(pingPos0, pingPos1, pingSize);
                    break;
                }
            }
        }
 public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
 {
     drawer.DrawWireCapsule(_capsuleA.position, _capsuleB.position, _capsuleRadius);
 }