Ejemplo n.º 1
0
        public bool Collide(AttackableUnit target)
        {
            var   unitCoords     = target.Position;
            var   targetDistance = Vector2.Distance(Begin, unitCoords);
            float targetAngle    = Geo.GetAngleDegrees(Begin, unitCoords);
            bool  result         = targetDistance <= Radius && targetAngle >= BeginAngle && targetAngle <= EndAngle;

            return(result);
        }
Ejemplo n.º 2
0
        public Cone(Vector2 begin, Vector2 end, float angleDeg)
        {
            Radius = Vector2.Distance(begin, end);

            float middlePointAngle = Geo.GetAngleDegrees(begin, end);

            Begin      = begin;
            End        = end;
            BeginAngle = middlePointAngle - angleDeg;
            EndAngle   = middlePointAngle + angleDeg;
        }