/// <summary> /// Constructor /// </summary> public PrisonGame() { // XNA startup graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Create objects for the parts of the ship for(int i=1; i<=6; i++) { phibesModels.Add(new PrisonModel(this, i)); } // Create a player object player = new Player(this); alien = new Alien(this); dalek = new Dalek(this); //gort = new Gort(this); // Some basic setup for the display window this.IsMouseVisible = true; this.Window.AllowUserResizing = true; this.graphics.PreferredBackBufferWidth = 1024; this.graphics.PreferredBackBufferHeight = 768; // Basic camera settings camera = new Camera(graphics); camera.FieldOfView = MathHelper.ToRadians(42); camera.Eye = new Vector3(800, 180, 1053); camera.Center = new Vector3(275, 90, 1053); lineDraw = new PSLineDraw(this, Camera); this.Components.Add(lineDraw); }
public Player(PrisonGame game) { this.game = game; SetPlayerTransform(); #region models dalekInfo = new Dalek(new Vector3(700, 0, -500)); stuckPies = new List<PieClass>(); victoria = new AnimatedModel(game, "Victoria",this); bazooka = new AnimatedModel(game, "PieBazooka",this); DalekModel = new AnimatedModel(game, "Dalek",this); Pies = new AnimatedModel(game, "pies",this); Alien = new AnimatedModel(game, "Alien",this); spit = new AnimatedModel(game, "Spit",this); #endregion #region victoriaClips victoria.AddAssetClip("dance", "Victoria-dance"); victoria.AddAssetClip("stance", "Victoria-stance"); victoria.AddAssetClip("walk", "Victoria-walk"); victoria.AddAssetClip("walkstart", "Victoria-walkstart"); victoria.AddAssetClip("walkloop", "Victoria-walkloop"); victoria.AddAssetClip("leftturn", "Victoria-leftturn"); victoria.AddAssetClip("rightturn", "Victoria-rightturn"); //bazooka victoria.AddAssetClip("crouch", "Victoria-crouchbazooka"); victoria.AddAssetClip("lowerB", "Victoria-lowerbazooka"); victoria.AddAssetClip("raiseB", "Victoria-raisebazooka"); victoria.AddAssetClip("walkstartB", "Victoria-walkstartbazooka"); victoria.AddAssetClip("walkloopB", "Victoria-walkloopbazooka"); #endregion #region Alien Alien.AddAssetClip("eat", "Alien-catcheat"); Alien.AddAssetClip("ob", "Alien-ob"); Alien.AddAssetClip("walkStart", "Alien-walkstart"); Alien.AddAssetClip("walkloop", "Alien-walkloop"); Alien.AddAssetClip("stance", "Alien-stance"); Alien.AddAssetClip("tantrum", "Alien-trantrum"); #endregion }
public void DalekDraw(GraphicsDeviceManager graphics, GameTime gameTime, Matrix transform, Dalek dalek) { for (int i = 0; i < model.Meshes.Count; i++) { ModelMesh mesh = model.Meshes[i]; { if (i != 0 && i != 1) { foreach (Effect effect in mesh.Effects) { effect.Parameters["World"].SetValue(absoTransforms[mesh.ParentBone.Index]* transform); effect.Parameters["yValue"].SetValue(1 - 2 * sliming); effect.Parameters["Light1Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 0)); effect.Parameters["Light1Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 1)); effect.Parameters["Light2Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 2)); effect.Parameters["Light2Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 3)); effect.Parameters["Light3Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 4)); effect.Parameters["Light3Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 5)); effect.Parameters["Light4Location"].SetValue(PrisonModel.LightInfo(playInfo.previousSection, 0)); effect.Parameters["Light4Color"].SetValue(PrisonModel.LightInfo(playInfo.previousSection, 1)); if (skelToBone != null) { effect.Parameters["Bones"].SetValue(skinTransforms); } effect.Parameters["View"].SetValue(game.Camera.View); effect.Parameters["Projection"].SetValue(game.Camera.Projection); effect.Parameters["doorOpenPercent"].SetValue(playInfo.doorOpenPercentage); } mesh.Draw(); } else { foreach (Effect effect in mesh.Effects) { Vector3 fixTrans; if(dalek.bodyAngle==0) fixTrans= new Vector3(0, 0, -10); else fixTrans = new Vector3(0, 0, 10); effect.Parameters["World"].SetValue(absoTransforms[mesh.ParentBone.Index]*Matrix.CreateTranslation(0, 0, 10)*Matrix.CreateRotationY(dalek.rotationAngle-dalek.bodyAngle)*transform*Matrix.CreateTranslation(fixTrans)); effect.Parameters["yValue"].SetValue(1 - 2 * sliming); effect.Parameters["Light1Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 0)); effect.Parameters["Light1Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 1)); effect.Parameters["Light2Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 2)); effect.Parameters["Light2Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 3)); effect.Parameters["Light3Location"].SetValue(PrisonModel.LightInfo(playInfo.section, 4)); effect.Parameters["Light3Color"].SetValue(PrisonModel.LightInfo(playInfo.section, 5)); effect.Parameters["Light4Location"].SetValue(PrisonModel.LightInfo(playInfo.previousSection, 0)); effect.Parameters["Light4Color"].SetValue(PrisonModel.LightInfo(playInfo.previousSection, 1)); effect.Parameters["doorOpenPercent"].SetValue(playInfo.doorOpenPercentage); if (skelToBone != null) { effect.Parameters["Bones"].SetValue(skinTransforms); } effect.Parameters["View"].SetValue(game.Camera.View); effect.Parameters["Projection"].SetValue(game.Camera.Projection); } mesh.Draw(); } } } }