Exemple #1
0
        public bool CanHit(Hero target)
        {
            var handle = target.Handle;

            var targetPos = target.Position;

            if (!(targetPos.Distance2D(BombPosition) <= Radius))
            {
                HeroManager.Remove(handle);
                return(false);
            }
            var pred   = Prediction.PredictedXYZ(target, 250 + Game.Ping);
            var canHit = pred.Distance2D(BombPosition) <= Radius;

            if (canHit)
            {
                float underHit;
                if (!HeroManager.TryGetValue(handle, out underHit))
                {
                    HeroManager.Add(handle, Game.RawGameTime);
                }
            }
            else
            {
                HeroManager.Remove(handle);
            }
            return(canHit);
        }