Beispiel #1
0
        private void ContinueFrom(RoadField field)
        {
            this.field = field.GetNext();
            decorated.Subject.SetPosition(new Position(this.field.X, this.field.Y));
            decorated.SetDirection(field.GetNext().Direction);
            path = 0;
            switch (this.field.Direction)
            {
            case Direction8.North:
                decorated.SetVelocity(0, -speed);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.South:
                decorated.SetVelocity(0, speed);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.East:
                decorated.SetVelocity(speed, 0);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.West:
                decorated.SetVelocity(-speed, 0);
                pathAcc = CM.GetXStep();
                break;
            }
        }
Beispiel #2
0
        public void GoRound(Ring ring)
        {
            RoadField start = ring.GetStartField();

            field = start;
            decorated.Subject.SetPosition(new Position(field.X, field.Y));
            //decorated.Subject.SetDirection(field.Direction);
            path = 0;

            switch (field.Direction)
            {
            case Direction8.North:
                decorated.SetVelocity(0, -speed);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.South:
                decorated.SetVelocity(0, speed);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.East:
                decorated.SetVelocity(speed, 0);
                pathAcc = CM.GetXStep();
                break;

            case Direction8.West:
                decorated.SetVelocity(-speed, 0);
                pathAcc = CM.GetXStep();
                break;
            }
            decorated.SetDirection(field.GetNext().Direction);
        }
Beispiel #3
0
 public RingBuilder StartTo(Direction8 direction)
 {
     multishape = new List <IPaintable>();
     lastField  = new RoadField(startPosition, direction, color);
     startField = lastField;
     multishape.Add(startField);
     return(this);
 }
Beispiel #4
0
        public RoadField(RoadField predecessor, Direction8 direction)
        {
            double module = predecessor.Module;

            this.module = module;
            var position = GetNewPosition(predecessor.GetPosition(), predecessor.direction, module);

            area = new Component
            {
                Subject = new Rectangle
                {
                    Width  = module,
                    Height = module,
                    Fill   = predecessor.area.Subject.Fill
                },
                X = position.X,
                Y = position.Y
            };
            this.direction   = direction;
            predecessor.next = this;
        }
Beispiel #5
0
 public RoadField(RoadField predecessor, Direction8 direction, RoadField successor) :
     this(predecessor, direction)
 {
     this.next = successor;
 }
Beispiel #6
0
 public RingBuilder CloseTo(Direction8 direction)
 {
     lastField = new RoadField(lastField, direction, startField);
     multishape.Add(lastField);
     return(this);
 }
Beispiel #7
0
 public Ring(RoadField startFiled, List <IPaintable> multishape)
 {
     this.startFiled = startFiled;
     this.multishape = multishape;
 }