Ejemplo n.º 1
0
        public Racer(RacerId rID, int ship_Number, RacerType racer_Type)
        {
            shipNumber           = ship_Number;
            racerType            = racer_Type;
            racerID              = rID;
            raceTiming           = new RaceTiming(this);
            shipDrawing          = new ShipDrawing(new Func <Matrix>(() => Matrix.Identity), new Func <Vector3>(() => Vector3.Zero), this);
            beatQueue            = new BeatQueue(this);
            racerPoints          = new RacerPoints();
            visualizationSystems = new ParticleSystemManager();
            globalSystems        = new ParticleSystemManager();
            //setColour(1);//Set to red
            //Hum = SoundManager.getEngineHum();
            //if (this.GetType() == typeof(RacerHuman))
            //{
            //    Hum.Play();
            //}
            constructRaceVariables();

            if (racerType == RacerType.AI)
            {
                constructRandomShip(shipNumber);
            }

            //Setup effect to render the ConvexHull of physicsBody with transparency
            //SetupHullRenderer();
        }
Ejemplo n.º 2
0
        public virtual void startRaceProcedure()
        {
            // Not the actual race but the putting of the cars on the map before countdown
            raceProcedureBegun     = true;
            raceOver               = false;
            SoundManager.raceBegan = false;
            // Give each ship a ship physics
            // Console.Write("Started adding physics to each ship...");
            foreach (Racer racer in Race.currentRacers)
            {
                RacerType newRacerType = racer.racerType;
                if (newRacerType == RacerType.None)
                {
                    newRacerType = RacerType.LocalHuman;
                }
                racer.shipNumber = Race.currentRacers.IndexOf(racer);
                racer.insertShipOnMap(newRacerType);
            }
            // Console.WriteLine("Done");

            // Construct the rankings for each ship
            if (areRanksRequired)
            {
                rankings = new List <Racer>();
                calculateRanks();
            }

            // Begin the countdown
            countDownRunning = true;
            SoundManager.RaceStart(4);
            countDownTimer.Start();
        }
Ejemplo n.º 3
0
        public Racer(RacerId rID, int ship_Number, RacerType racer_Type)
        {
            shipNumber = ship_Number;
            racerType = racer_Type;
            racerID = rID;
            raceTiming=new RaceTiming(this);
            shipDrawing = new ShipDrawing(new Func<Matrix>(() => Matrix.Identity), new Func<Vector3>(() => Vector3.Zero), this);
            beatQueue = new BeatQueue(this);
            racerPoints = new RacerPoints();
            visualizationSystems = new ParticleSystemManager();
            globalSystems = new ParticleSystemManager();
            //setColour(1);//Set to red
            //Hum = SoundManager.getEngineHum();
            //if (this.GetType() == typeof(RacerHuman))
            //{
            //    Hum.Play();
            //}
            constructRaceVariables();

            if (racerType == RacerType.AI)
            {
                constructRandomShip(shipNumber);
            }

            //Setup effect to render the ConvexHull of physicsBody with transparency
            //SetupHullRenderer();
        }
Ejemplo n.º 4
0
 public virtual void insertShipOnMap(RacerType newRacerType)
 {
     racerType   = newRacerType;
     shipPhysics = new ShipPhysics(this);
     shipDrawing.setPositionFunctions(new Func <Matrix>(() => shipPhysics.DrawOrientationMatrix), new Func <Vector3>(() => shipPhysics.ShipPosition));
     setupRacingControls();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This event handler will be called whenever a new gamer joins the session.
        /// We use it to allocate a Ship object, and associate it with the new gamer.
        /// </summary>
        void GamerJoinedEventHandler(object sender, GamerJoinedEventArgs e)
        {
            //int gamerIndex = networkSession.AllGamers.IndexOf(e.Gamer);
            RacerType pType = RacerType.Remote;

            if (e.Gamer.IsLocal)
            {
                pType = RacerType.LocalHuman;
            }
            //TODO: uncomment this code and make it work//e.Gamer.Tag = Race.addPlayer(pType);
        }
Ejemplo n.º 6
0
 public virtual void insertShipOnMap(RacerType newRacerType)
 {
     racerType = newRacerType;
     shipPhysics = new ShipPhysics(this);
     shipDrawing.setPositionFunctions(new Func<Matrix>(() => shipPhysics.DrawOrientationMatrix), new Func<Vector3>(() => shipPhysics.ShipPosition));
     setupRacingControls();
 }
Ejemplo n.º 7
0
 public override void insertShipOnMap(RacerType newRacerType)
 {
     base.insertShipOnMap(newRacerType);
     localCamera.nextStage();
 }
Ejemplo n.º 8
0
 public RacerHuman(RacerId rID, int shipNumber, RacerType racer_Type, int viewportIndex, Boolean hasPhysics)
     : base(rID, shipNumber, racer_Type)
 {
     cameraIndex = viewportIndex;
     localCamera = new CameraWrapper(this);
 }
Ejemplo n.º 9
0
 public override void insertShipOnMap(RacerType newRacerType)
 {
     base.insertShipOnMap(newRacerType);
     localCamera.nextStage();
 }
Ejemplo n.º 10
0
 public RacerHuman(RacerId rID, int shipNumber, RacerType racer_Type, int viewportIndex, Boolean hasPhysics)
     : base(rID, shipNumber, racer_Type)
 {
     cameraIndex = viewportIndex;
     localCamera = new CameraWrapper(this);
 }