상속: Vtj.Gaming.GameSystem
예제 #1
0
        protected override void Init()
        {
            if (jQuery.Browser.Mozilla || jQuery.Browser.Opera)
            {
                _music = LoadAudio("Audio/race.ogg");
            }
            else
            {
                _music = LoadAudio("Audio/race.mp3");
            }

            TimeLeft = RoadLength / 35;

            Position = 0;
            Shift    = 0;

            pendingTimers = new List <int>();

            AddSystem(new RoadSystem());
            AddSystem(new CloudSystem());
            AddSystem(new ObstacleSystem());
            AddSystem(_npcSystem         = new NpcSystem());
            AddSystem(CarSystem          = new CarSystem());
            AddSystem(_engineSoundSystem = new EngineSoundSystem());

            // Get reference to game images
            _backgroundImage = LoadImage("Images/Race/bg.png", false);
            _timeLeftFrame   = LoadImage("Images/Race/TimeLeft.png", false);
            _meterImage      = LoadImage("Images/Race/rpm10.png", false);
            _markerImage     = LoadImage("Images/Race/marker.png", false);

            // Setup the track
            Curve = 0;

            _rpm   = 200;
            Status = RaceStatus.Starting;

            // Calculate the distance table for track rendering
            DistanceTable = new float[Lines];
            for (int i = 0; i < Lines + 1; i++)
            {
                DistanceTable[i] = 1000000 / (300 - i);
            }

            ShowMessage(_startMessage);
            Window.SetTimeout(delegate()
            {
                HideMessage();
                Status = RaceStatus.Running;
                _music.Play();

                _music.AddEventListener("ended", delegate(ElementEvent e) { _music.Play(); }, false);
            }, 3000);
        }
예제 #2
0
        protected override void Init()
        {
            if (jQuery.Browser.Mozilla)
                _music = LoadAudio("Audio/race.ogg");
            else
                _music = LoadAudio("Audio/race.mp3");

            TimeLeft = RoadLength / 35;

            Position = 0;
            Shift = 0;

            pendingTimers = new List<int>();

            AddSystem(new RoadSystem());
            AddSystem(new CloudSystem());
            AddSystem(new ObstacleSystem());
            AddSystem(_npcSystem = new NpcSystem());
            AddSystem(CarSystem = new CarSystem());
            AddSystem(_engineSoundSystem = new EngineSoundSystem());

            // Get reference to game images
            _backgroundImage = LoadImage("Images/Race/bg.png", false);
            _timeLeftFrame = LoadImage("Images/Race/TimeLeft.png", false);
            _meterImage = LoadImage("Images/Race/rpm10.png", false);
            _markerImage = LoadImage("Images/Race/marker.png", false);

            // Setup the track
            Curve = 0;

            _rpm = 200;
            Status = RaceStatus.Starting;

            // Calculate the distance table for track rendering
            DistanceTable = new float[Lines];
            for (int i = 0; i < Lines + 1; i++)
            {
                DistanceTable[i] = 1000000 / (300 - i);
            }

            ShowMessage(_startMessage);
            Window.SetTimeout(delegate()
            {
                HideMessage();
                Status = RaceStatus.Running;
                _music.Play();

                _music.AddEventListener("ended", delegate(ElementEvent e) { _music.Play(); }, false);
            }, 3000);
        }