Esempio n. 1
0
        public override void FireInternal()
        {
            activeBlades.ForEach(b => { if (b.Lifetime.IsExpired == false)
                                        {
                                            b.Lifetime.Dispose();
                                        }
                                 });
            activeBlades.Clear();

            Sound.Play("sword");
            for (var i = 1; i < 1 + SpaceExtensions.NormalizeQuantity(Range, CalculateAngleToTarget()); i++)
            {
                var location  = Holder.Center().MoveTowards(CalculateAngleToTarget(), i);
                var newBounds = Rectangular.Create(location.Left - .5f, location.Top - .5f, 1, 1);
                if (SpaceTime.CurrentSpaceTime.IsInBounds(newBounds))
                {
                    var blade = new Blade()
                    {
                        Holder = this.Holder
                    };
                    var holderLocation = Holder.TopLeft();
                    blade.MoveTo(newBounds.Left, newBounds.Top);
                    SpaceTime.CurrentSpaceTime.Add(blade);
                    activeBlades.Add(blade);
                }
            }
        }
Esempio n. 2
0
        public void Work()
        {
            var angleToTarget = Me.CalculateAngleTo(Me.Target);
            var oppositeAngle = angleToTarget;// SpaceExtensions.GetOppositeAngle(angleToTarget);
            var newLocation   = SpaceExtensions.MoveTowards(Me.TopLeft(), oppositeAngle, 1);
            var overlapCount  = SpaceTime.CurrentSpaceTime.Elements.Where(e => Rectangular.Create(newLocation.Left, newLocation.Top, 1, 1).OverlapPercentage(e) > 0).Count();

            if (overlapCount == 0)
            {
                Me.MoveTo(newLocation.Left, newLocation.Top);
            }
        }