Beispiel #1
0
        public LaserRay SetLaserIntersect(LaserSource src, FPoint e, LaserRay otherRay, LaserSource otherSource, LaserRayTerminator t)
        {
            if ((Start - e).LengthSquared() < FloatMath.EPSILON4)
            {
                src.Lasers.Remove(this);
                return(Source?.SetLaserIntersect(src, Source.End, otherRay, otherSource, t));
            }

            End        = e;
            Terminator = t;
            _length    = null;
            _angle     = null;

            TerminatorRays.Add(Tuple.Create(otherRay, otherSource));

#if DEBUG
            if (!Start.IsValid)
            {
                SAMLog.Error("LASER::Assert_2-SV", "!Start.IsValid");
            }
            if (!End.IsValid)
            {
                SAMLog.Error("LASER::Assert_2-EV", "!End.IsValid");
            }
            if ((End - Start).LengthSquared() < FloatMath.EPSILON7 * FloatMath.EPSILON7)
            {
                SAMLog.Error("LASER::Assert_2-ESV", "(End - Start).LengthSquared() < FloatMath.EPSILON7 * FloatMath.EPSILON7");
            }
#endif

            return(this);
        }
Beispiel #2
0
        public LaserRay(FPoint s, FPoint e, LaserRay src, LaserRayTerminator t, int d, bool g, object sign, object eign, float sd, Cannon tc, RayType rt)
        {
            Depth          = d;
            InGlass        = g;
            StartIgnoreObj = sign;
            EndIgnoreObj   = eign;
            Start          = s;
            End            = e;
            Source         = src;
            Terminator     = t;
            TargetCannon   = tc;
            TerminatorRays = new List <Tuple <LaserRay, LaserSource> >();
            SourceDistance = sd;
            RayType        = rt;

#if DEBUG
            if (!Start.IsValid)
            {
                SAMLog.Error("LASER::Assert_1-SV", "!Start.IsValid");
            }
            if (!End.IsValid)
            {
                SAMLog.Error("LASER::Assert_1-EV", "!End.IsValid");
            }
            if ((End - Start).LengthSquared() < FloatMath.EPSILON7 * FloatMath.EPSILON7)
            {
                SAMLog.Error("LASER::Assert_1-ESV", "(End - Start).LengthSquared() < FloatMath.EPSILON7 * FloatMath.EPSILON7");
            }
#endif
        }