コード例 #1
0
        private void place()
        {
            Cart cart = new Cart(currentField);

            Field rail = new Rail('-');

            rail.Place(cart);
        }
コード例 #2
0
        private void tochar()
        {
            Ship ship = new Ship(currentField);
            Cart cart = new Cart(startpoint);

            EmptyField emptyField   = new EmptyField();
            Dock       dock         = new Dock();
            Rail       rail         = new Rail('-');
            StartPoint startpointer = new StartPoint('A');
            Storage    storage      = new Storage();
            Switch     switchje     = new Switch('S');
            Water      water        = new Water();

            ship.ToChar();
            cart.ToChar();

            emptyField.ToChar();
            dock.ToChar();
            rail.ToChar();
            startpointer.ToChar();
            storage.ToChar();
            switchje.ToChar();
            water.ToChar();
        }
コード例 #3
0
        public void CreateGame()
        {
            //aanmaken van rivier
            RiverFirst = new River();
            River currentR = (River)RiverFirst;

            currentR = (River)MakeMultipleLinks(currentR, 10);

            River quayField = currentR;

            currentR.Next = new River();
            currentR      = (River)currentR.Next;
            currentR.Next = new River();

            AFirst = new Rail();
            Field currentA = AFirst;

            currentA = MakeMultipleLinks(currentA, 4);

            BFirst = new Rail();
            Field currentB = BFirst;

            currentB = MakeMultipleLinks(currentB, 4);

            CFirst = new Rail();
            Field currentC = CFirst;

            currentC = MakeMultipleLinks(currentC, 7);

            Switch switch1 = new Switch {
                State = State.FROMLOWER, Upper = (Rail)currentA, Lower = (Rail)currentB, Next = new Rail()
            };

            currentA.Next = switch1;
            currentB.Next = switch1;

            Switch switch2 = new Switch {
                State = State.TOUPPER, Upper = new Rail(), Lower = new Rail()
            };

            switch2.Next = switch2.Upper;

            switch1.Next.Next  = switch2;
            switch2.Lower.Next = new Rail();

            Switch switch3 = new Switch {
                State = State.FROMLOWER, Upper = (Rail)switch2.Lower.Next, Lower = (Rail)currentC, Next = new Rail()
            };

            switch2.Lower.Next.Next = switch3;
            currentC.Next           = switch3;

            Switch switch4 = new Switch {
                State = State.TOLOWER, Upper = new Rail(), Lower = new Rail()
            };

            switch4.Next       = switch4.Lower;
            switch4.Upper.Next = new Rail();

            switch3.Next.Next = switch4;

            Field currentD = switch2.Upper;

            currentD = MakeMultipleLinks(currentD, 4);

            Switch switch5 = new Switch {
                State = State.FROMUPPER, Upper = (Rail)currentD, Lower = (Rail)switch4.Upper.Next, Next = new Rail()
            };

            currentD.Next           = switch5;
            switch4.Upper.Next.Next = switch5;

            Field currentE = switch5.Next;

            //Rails vanaf switch 5.next tot kade
            currentE = MakeMultipleLinks(currentE, 6);

            //Kade wordt gedefinieert
            quayField.Quay = currentE;

            //Rest van de 9 rails na kade
            currentE = MakeMultipleLinks(currentE, 10);

            Field CurrentF = switch4.Lower;

            CurrentF = MakeMultipleLinks(CurrentF, 6);

            CurrentF.Next = new Shunter();
            CurrentF      = CurrentF.Next;

            CurrentF = MakeMultipleLinks(CurrentF, 7);

            switch2.Upper.PrintValue = "╔";
            switch2.Lower.PrintValue = "╚";
            switch4.Upper.PrintValue = "╔";
            switch4.Lower.PrintValue = "╚";
            ((Rail)switch4.Lower.Next.Next.Next).PrintValue      = "╗";
            ((Rail)switch4.Lower.Next.Next.Next.Next).PrintValue = "╝";

            //6-12 en 3-12
            ((Rail)switch5.Next.Next).PrintValue                = "╝";
            ((Rail)switch5.Next.Next.Next).PrintValue           = "║";
            ((Rail)switch5.Next.Next.Next.Next).PrintValue      = "║";
            ((Rail)switch5.Next.Next.Next.Next.Next).PrintValue = "╗";

            ((Rail)AFirst).PrintValue = "A";
            ((Rail)BFirst).PrintValue = "B";
            ((Rail)CFirst).PrintValue = "C";

            Switches[0] = switch1;
            Switches[1] = switch2;
            Switches[2] = switch3;
            Switches[3] = switch4;
            Switches[4] = switch5;
        }