void OnDrawGizmos()
    {
        VolatileWorld world = VolatileWorld.Instance;

        if ((world != null) && (Application.isPlaying == true))
        {
            VoltRayResult result = new VoltRayResult();
            VoltRayCast   cast   =
                new VoltRayCast(
                    ((Vector2)transform.position).ToTSVector2(),
                    ((Vector2)(transform.position + (transform.up * 100.0f))).ToTSVector2());

            if (this.radius > 0.0f)
            {
                world.World.CircleCast(ref cast, this.radius, ref result, this.Filter, -this.frameOffset);
            }
            else
            {
                world.World.RayCast(ref cast, ref result, this.Filter, -this.frameOffset);
            }

            float drawRadius = (this.radius == 0.0f) ? 0.2f : this.radius;
            Gizmos.color = this.color;
            if (result.IsValid == true)
            {
                Vector2 point = transform.position + (transform.up * (float)result.Distance);
                Gizmos.DrawLine(transform.position, point);
                Gizmos.DrawWireSphere(point, drawRadius);
            }
            else
            {
                Gizmos.DrawLine(transform.position, transform.position + (transform.up * 100.0f));
            }
        }
    }
Beispiel #2
0
 void Awake()
 {
     VolatileWorld.instance = this;
     this.World = new VoltWorld(this.historyLength);
 }
Beispiel #3
0
 void Awake()
 {
     VolatileWorld.instance = this;
     this.World             = new VoltWorld(this.historyLength);
 }