Пример #1
0
 public void Undo(TabNavigation navEngine)
 {
     if (PreviousPosition != null)
     {
         PreviousPosition.Execute(navEngine);
     }
 }
Пример #2
0
        private void SetPreviousPosition()
        {
            if (PreviousPosition is null)
            {
                PreviousPosition = new Vector();
            }

            PreviousPosition.Set(Position);
        }
 public override void Do(ActionArgs args)
 {
     if (this.Entity != null && args != null && args is ChangeCurrentSmoothingArgs)
     {
         PreviousPosition position = this.Entity.GetComponent("PreviousPosition") as PreviousPosition;
         if (position != null)
         {
             position.currentSmoothing = ((ChangeCurrentSmoothingArgs)args).Delta;
         }
     }
 }
Пример #4
0
 public override void Do(ActionArgs args)
 {
     if (this.Entity != null && args != null && args is ChangePositionArgs)
     {
         PreviousPosition position = this.Entity.GetComponent("PreviousPosition") as PreviousPosition;
         if (position != null)
         {
             Vector2 newPosition = ((ChangePositionArgs)args).Delta;
             position.Vector2Pos = newPosition;
         }
     }
 }
Пример #5
0
 public PhysicsShape()
 {
     Velocity        = new Velocity();
     HistoryPosition = new PreviousPosition();
 }
Пример #6
0
        private void CheckColour(Vector2 vect, ref Color[,] colors2D, ref Polygon polygon, PreviousPosition prevPos)
        {
            bool isValidCoord = false;

            if (colors2D[(int)vect.X, (int)vect.Y] == Color.Black && !polygon.ContainedPoints.Contains(vect))
            {
                isValidCoord = true;
                polygon.ContainedPoints.Add(vect);
                colors2D[(int)vect.X, (int)vect.Y] = Color.Pink;
                Color c = colors2D[(int)vect.X, (int)vect.Y];
            }

            if (isValidCoord)
            {
                if (vect.X + 1 < mapWidth && prevPos != PreviousPosition.Left)
                    CheckColour(new Vector2(vect.X + 1, vect.Y), ref colors2D, ref polygon, PreviousPosition.Right);
                if (vect.X - 1 > 0 && prevPos != PreviousPosition.Right)
                    CheckColour(new Vector2(vect.X - 1, vect.Y), ref colors2D, ref polygon, PreviousPosition.Left);
                if (vect.Y + 1 < mapHeight && prevPos != PreviousPosition.Down)
                    CheckColour(new Vector2(vect.X, vect.Y + 1), ref colors2D, ref polygon, PreviousPosition.Up);
                if (vect.Y - 1 < 0 && prevPos != PreviousPosition.Up)
                    CheckColour(new Vector2(vect.X, vect.Y - 1), ref colors2D, ref polygon, PreviousPosition.Down);

            }
            return;
        }