Example #1
0
        /// <summary>
        /// 空の世界を作成
        /// </summary>
        /// <param name="sz">世界の大きさ (H,V,D)</param>
        /// <param name="tempolary"></param>
        /// <param name="waterLevel"></param>
        private WorldDefinition(Distance sz, int waterLevel, bool tempolary)
        {
            this.name = "Terra Incognita";
            //! this.name = "ななしさん";
            this.size       = sz;
            this.waterLevel = (byte)waterLevel;
            voxels          = new SparseVoxelArray(sz.x, sz.y, sz.z);
            groundLevels    = new byte[sz.x, sz.y];

            for (int y = 0; y < sz.y; y++)
            {
                for (int x = 0; x < sz.x; x++)
                {
                    groundLevels[x, y] = (byte)waterLevel;
                }
            }

            if (tempolary)
            {
                onVoxelChanged += new VoxelChangeListener(EmptyHandler);
            }
            else
            {
                // add system-defined controllers to the list
                // trainControllers.add( DelegationTrainControllerImpl.theInstance );
                trainControllers.add(SimpleTrainControllerImpl.theInstance);

                developmentAlgorithm = new DevelopmentAlgorithm();
                clock.registerRepeated(new ClockHandler(developmentAlgorithm.handleClock),
                                       TimeLength.fromHours(1));

                // for test
                new Train(rootTrainGroup, "3-Car High-Speed Train", 3,
                          //! new Train( rootTrainGroup, "3両高速編成",3,
                          (TrainContribution)PluginManager.GetContribution("{3983B298-ADB1-4905-94E5-03B7AAE5A221}"),
                          SimpleTrainControllerImpl.theInstance);
                new Train(rootTrainGroup, "5-Car Medium-Speed Train", 5,
                          //! new Train( rootTrainGroup, "5両中速編成",5,
                          (TrainContribution)PluginManager.GetContribution("{2C6F6C72-FA4B-4941-84C1-57553C8A5C2A}"),
                          SimpleTrainControllerImpl.theInstance);
                new Train(rootTrainGroup, "7-Car Low-Speed Train", 7,
                          //! new Train( rootTrainGroup, "7両低速編成",7,
                          (TrainContribution)PluginManager.GetContribution("{F7134C8E-6B63-4780-AF16-90D33131CD07}"),
                          SimpleTrainControllerImpl.theInstance);


                // when a voxel is changed, it should be notified to OutlookListeners automatically
                onVoxelChanged += new VoxelChangeListener(OnVoxelUpdated);

                landValue = new Development.LandValue(this);
            }
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="days"></param>
 /// <returns></returns>
 public static TimeLength fromDays(long days)
 {
     return(TimeLength.fromHours(days * 24));
 }