/// <summary> /// 描画する /// </summary> /// <param name="spriteBatch">スプライト描画用のオブジェクト</param> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { foreach (Attack attack in attacks) { attack.Draw(camera); } }
public void Draw(SpriteBatch spriteBatch, Camera camera) { foreach (NameDrawer nameDrawer in nameDrawers) { nameDrawer.Draw(spriteBatch, camera); } foreach (StockDrawer stackDrawer in stockDrawers) { stackDrawer.Draw(spriteBatch); } timer.Draw(spriteBatch); }
public CharactorPreview(Rectangle drawRect, Texture2D background, Texture2D ngTexture, PlayerIndex playerID) : base(drawRect) { this.drawRect = drawRect; this.playerID = playerID; this.camera = new Camera(); camera.FieldOfViewRadian = MathHelper.PiOver4; camera.Target = new Vector3(0, 0, -10); camera.Position = new Vector3(0.0f, 3, 6); this.background = background; this.ngTexture = ngTexture; info = new ModelInfo(); isConflict = false; }
/// <summary> /// 描画 /// </summary> public void Draw(Camera camera, ModelInfo modelInfo) { // ボーンの取得 Matrix[] bones = animationPlayer.GetSkinTransforms(); // ワールド座標 Matrix world = modelInfo.World; foreach (ModelMesh mesh in currentModel.Meshes) { foreach (SkinnedEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.SetBoneTransforms(bones); effect.World = world; effect.View = camera.View; effect.Projection = camera.Projection; } mesh.Draw(); } }
public void Draw(SpriteBatch spriteBatch, Camera camera) { if (player.IsDead) return; GraphicsDevice graphics = spriteBatch.GraphicsDevice; Viewport viewport = graphics.Viewport; Matrix rotatedView = Matrix.CreateRotationY(this.theta) * camera.View; Vector3 position = player.ModelInfo.Position; // 3次元座標からスクリーンの座標算出 // 本当なら深度での描画の判断しないといけないけどカメラ固定なので省略 Vector3 screenPosition3D = viewport.Project(position, camera.Projection, rotatedView, Matrix.Identity); Vector2 screenPosition = new Vector2(screenPosition3D.X, screenPosition3D.Y); // テキスト描画 //枠の描画 spriteBatch.DrawString(font, player.Name, new Vector2(screenPosition.X, screenPosition.Y - thickness), player.Color); spriteBatch.DrawString(font, player.Name, new Vector2(screenPosition.X, screenPosition.Y + thickness), player.Color); spriteBatch.DrawString(font, player.Name, new Vector2(screenPosition.X - thickness, screenPosition.Y), player.Color); spriteBatch.DrawString(font, player.Name, new Vector2(screenPosition.X + thickness, screenPosition.Y - thickness), player.Color); //文字の描画 spriteBatch.DrawString(font, player.Name, new Vector2(screenPosition.X, screenPosition.Y), Color.White); }
/// <summary> /// 描画する /// </summary> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { int i = 0; foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { //effect.EnableDefaultLighting(); //effect.DirectionalLight0.Direction = ModelInfo.Position; effect.DirectionalLight1.Direction = ModelInfo.Position + new Vector3(0.5f, 1.0f, 0.5f); //effect.DirectionalLight2.Direction = ModelInfo.Position; effect.World = ModelInfo.World; effect.View = camera.View; effect.Projection = camera.Projection; if (beforeFallTimer.IsRunning || IsFalling) { // 時間経過でブロックを落とす場合 if (IsDead) effect.DiffuseColor = new Vector3(0.0f, 0.0f, 0.0f); // 1Pが攻撃した場合:赤 else if (lastAttackPlayerInfo.Index == PlayerIndex.One) effect.DiffuseColor = new Vector3(1.0f, 0.0f, 0.0f); // 1Pが攻撃した場合:オレンジ else if (lastAttackPlayerInfo.Index == PlayerIndex.Two) effect.DiffuseColor = new Vector3(1.0f, 0.65f, 0.0f); // 1Pが攻撃した場合:緑 else if (lastAttackPlayerInfo.Index == PlayerIndex.Three) effect.DiffuseColor = new Vector3(0.0f, 1.0f, 0.0f); // 1Pが攻撃した場合:青 else if (lastAttackPlayerInfo.Index == PlayerIndex.Four) effect.DiffuseColor = new Vector3(0.0f, 0.0f, 1.0f); } else { effect.DiffuseColor = defaultDiffuseColor[i]; i++; } } mesh.Draw(); } }
/// <summary> /// リザルト描画メソッド /// </summary> /// <param name="camera">モデル用のカメラ</param> /// <param name="spriteBatch">テクスチャ用のスプライトバッチ</param>> public void Draw(Camera camera, SpriteBatch spriteBatch) { foreach (var player in players) { //player.Draw(camera); // player.Draw()では死んだプレイヤーが表示されない player.Model.Draw(camera, player.ModelInfo); } foreach (var rank in ranks) { rank.Draw(spriteBatch); } foreach (ModelMesh mesh in stage.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.DirectionalLight0.Direction = new Vector3(10.0f, 10.0f, 10.0f); effect.World = Matrix.CreateScale(Vector3.One) * Matrix.CreateTranslation(new Vector3(0.0f,-1.0f,0.0f)); effect.View = camera.View; effect.Projection = camera.Projection; } mesh.Draw(); } }
/// <summary> /// 描画する /// </summary> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { Field.Draw(camera); PlayerManager.Draw(camera); AttackManager.Draw(camera); }
/// <summary> /// 描画する /// </summary> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { if (IsDead) { return; } model.Draw(camera,ModelInfo); }
/// <summary> /// 描画する /// </summary> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = ModelInfo.World; effect.View = camera.View; effect.Projection = camera.Projection; } mesh.Draw(); } }
/// <summary> /// 描画する /// </summary> /// <param name="spriteBatch">スプライト描画用のオブジェクト</param> /// <param name="camera">モデル用のカメラ</param> public void Draw(Camera camera) { foreach (Block block in blocks) { if (block == null) { continue; } block.Draw(camera); } }