Beispiel #1
0
 public AIKart(int kartNum, Level level, byte[][,] weight)
 {
     rand = new Random(kartNum);
     Level = level;
     Weight = weight;
     position = new Vector3(rand.NextFloat(-10, 11), rand.NextFloat(-10, 11), rand.NextFloat(-10, 11));
 }
 public Room(Level level, string roomTitle, Vector3 pos, int seed)
 {
     this.level = level;
     room = roomTitle;
     floorPos = pos;
     trans = Matrix.Translation(floorPos);
     rand = new Random(seed);
 }
 public KartEntity(Level level, byte[][,] weight)
 {
     acceleration = 0;
     velocity = 0;
     angle = 0;
     World = Matrix.Zero;
     View = Matrix.Zero;
     Projection = Matrix.Zero;
     position = Vector3.Zero;
     Level = level;
     Weight = weight;
 }
 public Projectile(ProjectileType type, Model sphere, Vector3 position, Vector3 forward, float angle, Level host)
 {
     this.type = type;
     level = host;
     origin = Matrix.Translation(startLocation);
     this.forward = forward;
     pos = position;
     startLocation = position;
     model = sphere;
     effect = new BasicEffect(Main.Graphics.GraphicsDevice);
     if (this.type == ProjectileType.Red)
     {
         effect.LightingEnabled = true;
         effect.DirectionalLight0.DiffuseColor = Color.Red.ToVector3();
         effect.DirectionalLight0.Direction = new Vector3(1, 0, -1);
         effect.DirectionalLight0.SpecularColor = new Vector3(1, 0, 0);
         worth = 10;
         velocity = 100;
     }
     else if (this.type == ProjectileType.Green)
     {
         effect.LightingEnabled = true;
         effect.DirectionalLight0.DiffuseColor = Color.Green.ToVector3();
         effect.DirectionalLight0.Direction = new Vector3(1, 0, -1);
         effect.DirectionalLight0.SpecularColor = new Vector3(1, 0, 0);
         worth = 25;
         velocity = 120;
     }
     else
     {
         effect.LightingEnabled = true;
         effect.DirectionalLight0.DiffuseColor = Color.Blue.ToVector3();
         effect.DirectionalLight0.Direction = new Vector3(1, 0, -1);
         effect.DirectionalLight0.SpecularColor = new Vector3(1, 0, 0);
         worth = 100;
         velocity = 150;
     }
 }
 /// <summary>
 /// Event Handler for changing GameState.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void NewGameState(object sender, EventArgs args)
 {
     switch(gameState)
     {
         case GameStates.MainMenu:
             if (menu == null)menu = new Menu(this);
             menu.LoadContent();
             level = null;
             break;
         case GameStates.Play:
             if (level == null)
             {
                 level = new Level(this, menu.selectedKart);
                 level.LoadContent();
             }
             break;
         case GameStates.Pause:
             menu.type = MenuType.Pause;
             menu.LoadContent();
             break;
         case GameStates.EndGame:
             menu.type = MenuType.HighScores;
             menu.scores.recordScore(level.Player.Score, "");
             menu.LoadContent();
             break;
         default:
             break;
     }
 }
 public Camera(Level level)
 {
     Level = level;
 }
 public Player(Level level, string kart)
 {
     this.kart = kart;
     Level = level;
 }