コード例 #1
0
        public override void Evaluate()
        {
            if (currentForce != null)
            {
                new Force(SeekerSpeed, accelleration, SpaceExtensions.GetOppositeAngle(currentForce.Angle));
                currentForce = null;
            }

            if (IsSeeking && Element.CalculateDistanceTo(Seekee) < 1)
            {
                var myLeft = Seekee.CenterX() - (Element.Width / 2);
                var myTop  = Seekee.CenterY() - (Element.Height / 2);
                Element.MoveTo(myLeft, myTop);
                SeekerSpeed.SpeedX = 0;
                SeekerSpeed.SpeedY = 0;
                if (RemoveWhenReached)
                {
                    this.Lifetime.Dispose();
                }
            }
            else if (IsSeeking)
            {
                currentForce = new Force(SeekerSpeed, accelleration, Element.Center().CalculateAngleTo(Seekee.Center()));
            }
        }
コード例 #2
0
 public override void Initialize()
 {
     if (IsSeeking)
     {
         currentForce = new Force(SeekerSpeed, accelleration, Element.Center().CalculateAngleTo(Seekee.Center()));
     }
 }