/// <summary> /// initializes this screen. /// play a BGM sound. /// </summary> public override void InitializeScreen() { this.activeElapsedTime = TimeSpan.Zero; // creates a 2D layer. FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; this.refScene2DRoot.AddChild(this.spriteMain); spriteObjMain = this.spriteMain.AddSprite(0, "MainTitle"); this.refScene2DRoot.AddChild(this.spriteButton); // Initialize start button spriteObjStartButton = this.spriteButton.AddSprite(0, "Start Button"); AddMenuEntry(spriteObjStartButton); // Entry a start button // Initialize versus button spriteObjVersusButton = this.spriteButton.AddSprite(1, "Versus Button"); AddMenuEntry(spriteObjVersusButton);// Entry a versus button // Initialize exit button spriteObjExitButton = this.spriteButton.AddSprite(2, "Exit Button"); AddMenuEntry(spriteObjExitButton); // Entry a exit button // calculates all image size. OnSize(); // play the title music. GameSound.Play(SoundTrack.MainTitle); // play an open menu sound. GameSound.Play(SoundTrack.MenuOpen); }
/// <summary> /// Constructor /// </summary> /// <param name="instanceCount">creating instance count</param> /// <param name="textureFileName">texture file name</param> public TracerBullets(int id, int instanceCount, string textureFileName, GameSceneNode sceneParent) { this.id = id; textureResource = FrameworkCore.ResourceManager.LoadTexture(textureFileName); bullets = new BulletObject[instanceCount]; // Create instance bullets for (int i = 0; i < bullets.Length; i++) { bullets[i] = new BulletObject(i); } tracerBulletBillboard = new GameBillboard(); tracerBulletBillboard.Create(instanceCount, textureResource.Texture2D, RenderingSpace.World, false); tracerBulletBillboard.SourceBlend = Blend.SourceAlpha; tracerBulletBillboard.DestinationBlend = Blend.One; tracerBulletBillboard.BlendFunction = BlendFunction.Add; tracerBulletBillboard.AlphaBlendEnable = true; tracerBulletBillboard.DepthBufferEnable = true; tracerBulletBillboard.DepthBufferWriteEnable = false; tracerBulletBillboard.DepthBufferFunction = CompareFunction.Less; tracerBulletBillboard.AlphaFunction = CompareFunction.Greater; tracerBulletBillboard.CullMode = CullMode.None; sceneParent.AddChild(tracerBulletBillboard); }
public void SetAction(float time, GameSceneNode owner, bool visibledOwner) { this.actionTime = time; this.owner = owner; this.owner.Enabled = false; this.owner.Visible = visibledOwner; }
/// <summary> /// initializes this screen. /// </summary> public override void InitializeScreen() { this.activeElapsedTime = TimeSpan.Zero; // Create a 2D layer FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; // Play a title music GameSound.Play(SoundTrack.ReadyRoom); SetHorizontalEntryIndex(0, 0); SetHorizontalEntryIndex(1, 1); focusIndex[0] = 0; // default set focusIndex[1] = 1; // default set this.refScene2DRoot.AddChild(this.spriteBG); spriteObjBG = this.spriteBG.AddSprite(0, "Versus bg image"); this.refScene2DRoot.AddChild(this.spriteSelect); spriteObjSelectMech = new Sprite2DObject[4]; // Create the Grund image spriteObjSelectMech[0] = this.spriteSelect.AddSprite(0, "Grund"); // Create the Mark image spriteObjSelectMech[1] = this.spriteSelect.AddSprite(1, "Mark"); // Create the Kiev image spriteObjSelectMech[2] = this.spriteSelect.AddSprite(2, "Kiev"); // Create the Yager image spriteObjSelectMech[3] = this.spriteSelect.AddSprite(3, "Yager"); // Entry select player image AddMenuEntry(spriteObjSelectMech[0]); AddMenuEntry(spriteObjSelectMech[1]); AddMenuEntry(spriteObjSelectMech[2]); AddMenuEntry(spriteObjSelectMech[3]); this.refScene2DRoot.AddChild(this.spriteTextImage); // Create the VS image spriteObjVersus = this.spriteTextImage.AddSprite(0, "VS text"); // 1P image spriteObjSelectCursor[0] = this.spriteTextImage.AddSprite(1, "1P"); // 2P image spriteObjSelectCursor[1] = this.spriteTextImage.AddSprite(2, "2P"); // Calculate all image size OnSize(); // Play a open menu sound GameSound.Play(SoundTrack.MenuOpen); }
/// <summary> /// create a bullet group and create bullet instances. /// </summary> /// <param name="id">bullet group id</param> /// <param name="instanceCount">object count</param> /// <param name="textureFileName">bullet texture file</param> /// <param name="sceneParent">3D scene parent node</param> public void AddBulletInstance(int id, int instanceCount, string textureFileName, GameSceneNode sceneParent) { if (activeOn == false) return; TracerBullets defaultBullet = new TracerBullets(id, instanceCount, textureFileName, sceneParent); tracerBullets.Add( defaultBullet); }
/// <summary> /// Set area event /// </summary> /// <param name="position">The position of this event</param> /// <param name="radius">The radius of this event</param> /// <param name="owner">The scene owner of this event</param> /// <param name="visibledOwner"> /// Visibility of the scene owner before start this event /// </param> public void SetAction(Vector3 position, float radius, GameSceneNode owner, bool visibledOwner) { this.actionPosition = position; this.actionRadius = radius; this.owner = owner; this.owner.Enabled = false; this.owner.Visible = visibledOwner; }
public GameSceneNode AddChild(GameVpObject gameVpObject) { var node = new GameSceneNode(_gameInstance) { GameVpObject = gameVpObject, ParentNode = this }; ChildNodes.Add(gameVpObject.Id, new GameSceneNode(_gameInstance)); return(node); }
/// <summary> /// initializes this screen. /// </summary> public override void InitializeScreen() { // creates a 2D layer. FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; this.refScene2DRoot.AddChild(this.spriteBG); this.refScene2DRoot.AddChild(this.spriteLoadingText); // loading image. { loadingSprite = this.spriteBG.AddSprite(0, "Loading screen"); // Matching logo image size with screen size. loadingSprite.ScreenSize = new Vector2(FrameworkCore.ViewWidth, FrameworkCore.ViewHeight); float aspect = (float)FrameworkCore.ViewWidth / (float)FrameworkCore.ViewHeight; if (1.6f > aspect) // no wide screen { int recalcWidth = (int)(aspect / 1.6f * this.spriteBG.TextureResource.Width); loadingSprite.SourceRectangle = new Rectangle( ((this.spriteBG.TextureResource.Width - recalcWidth) / 2) - 140, 0, recalcWidth, this.spriteBG.TextureResource.Height); } } // loading text. { spriteObjNowLoading = this.spriteLoadingText.AddSprite(0, "Loading text"); spriteObjNowLoading.SourceRectangle = new Rectangle(362, 64, 333, 57); spriteObjNowLoading.Visible = true; spriteObjPressToContinue = this.spriteLoadingText.AddSprite(1, "Press A to Continue"); spriteObjPressToContinue.SourceRectangle = new Rectangle(170, 139, 653, 76); spriteObjPressToContinue.Visible = false; } // Calculate all image size OnSize(); }
/// <summary> /// create a bullet group and create bullet instances. /// </summary> /// <param name="id">bullet group id</param> /// <param name="instanceCount">object count</param> /// <param name="textureFileName">bullet texture file</param> /// <param name="sceneParent">3D scene parent node</param> public void AddBulletInstance(int id, int instanceCount, string textureFileName, GameSceneNode sceneParent) { if (activeOn == false) { return; } TracerBullets defaultBullet = new TracerBullets(id, instanceCount, textureFileName, sceneParent); tracerBullets.Add(defaultBullet); }
/// <summary> /// Constructs a new screen manager component. /// </summary> public GameScreenManager(Game game) : base(game) { scene2DFadeRoot = FrameworkCore.Scene2DFadeLayer; fadeSprite = new GameSprite2D(); scene2DFadeRoot.AddChild(fadeSprite); // Controller screenInput[0] = new GameScreenInput(PlayerIndex.One); screenInput[1] = new GameScreenInput(PlayerIndex.Two); screenInput[2] = new GameScreenInput(PlayerIndex.Three); screenInput[3] = new GameScreenInput(PlayerIndex.Four); }
/// <summary> /// Constructor. /// </summary> public GameLevel() { this.SceneWorldRoot = new GameSceneNode(); this.SceneWorldRoot.Name = "Scene World Root"; this.SceneMechRoot = new GameSceneNode(); this.SceneMechRoot.Name = "Scene Mech Root"; this.sceneParticleRoot = new GameSceneNode(); this.sceneParticleRoot.Name = "Scene Particles Root"; this.sceneParticleRoot.OrderWhenDraw = GameSceneNode.DrawOrderType.Descending; this.sceneCollisionRoot = new GameSceneNode(); this.sceneCollisionRoot.Name = "Scene Collisions Root"; this.sceneCollisionRoot.Visible = false; }
/// <summary> /// Constructor. /// </summary> public MessageBoxScreen(string message) { IsPopup = true; this.message = message; TransitionOnTime = TimeSpan.FromSeconds(0.2f); TransitionOffTime = TimeSpan.FromSeconds(0.2f); // Create messagebox font this.messageFont = FrameworkCore.FontManager.CreateFont("MessageFont", "Font/RobotGame_font"); this.controls = "\n(A) button OK\n(B) button Cancel"; this.refScene2DTopRoot = FrameworkCore.Scene2DTopLayer; }
/// <summary> /// removes every scene node and scene layer that have been attached to /// the scene root node. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { if (spriteBatch != null) { spriteBatch.Dispose(); spriteBatch = null; } } ClearScene3DRoot(disposing); ClearScene2DLayer(disposing); ClearScene2DOverlay(disposing); scene3DRoot = null; base.Dispose(disposing); }
/// <summary> /// Constructor. /// </summary> /// <param name="game">game</param> public RenderContext(Game game) : base(game) { // Create scene root nodes scene2DLayer = new List <GameSceneNode>(); scene2DOverlay = new List <GameSceneNode>(); GameSceneNode SceneFade = new GameSceneNode(); SceneFade.Name = "Scene2DFadeRoot"; GameSceneNode SceneTop = new GameSceneNode(); SceneTop.Name = "Scene2DTopRoot"; scene2DOverlay.Add(SceneFade); scene2DOverlay.Add(SceneTop); scene3DRoot = new GameSceneNode(); scene3DRoot.Name = "Scene3DRoot"; }
/// <summary> /// Constructor. /// </summary> /// <param name="type">event type</param> /// <param name="time">event execute time</param> /// <param name="owner">event owner</param> /// <param name="visibledOwner">owner visible flag</param> public GameTimeEvent(float time, GameSceneNode owner, bool visibledOwner) { SetAction(time, owner, visibledOwner); }
/// <summary> /// Constructor. /// </summary> protected BaseStageScreen() { TransitionOnTime = TimeSpan.FromSeconds(5.0f); TransitionOffTime = TimeSpan.FromSeconds(2.0f); this.refScene3DRoot = FrameworkCore.Scene3DRoot; this.refViewer = FrameworkCore.Viewer; this.refRenderContext = FrameworkCore.RenderContext; this.refGraphicsDevice = FrameworkCore.Game.GraphicsDevice; this.refCollisionContext = FrameworkCore.CollisionContext; this.refParticleManager = FrameworkCore.ParticleManager; this.gameLevel = new GameLevel(); this.playerOldLife = new int[2]; this.playerReduceArmorElapsedTime = new float[2]; this.pickupMessageElapsedTime = new float[2]; this.playerReduceArmorElapsedTime = new float[2]; this.missionResultElapsedTime = 0.0f; }
/// <summary> /// Constructor. /// </summary> /// <param name="type">event type</param> /// <param name="position">position</param> /// <param name="radius">area radius</param> /// <param name="owner">event owner</param> /// <param name="visibledOwner">owner visible flag</param> public GameAreaEvent(Vector3 position, float radius, GameSceneNode owner, bool visibledOwner) { SetAction(position, radius, owner, visibledOwner); }
/// <summary> /// initializes this screen. /// </summary> public override void InitializeScreen() { this.refScene3DRoot.RemoveAllChild(true); this.refScene3DRoot.AddChild(this.GameLevel.SceneWorldRoot); this.refScene3DRoot.AddChild(this.GameLevel.SceneMechRoot); this.refScene3DRoot.AddChild(this.GameLevel.SceneParticleRoot); this.refScene3DRoot.AddChild(this.GameLevel.SceneCollisionRoot); RobotGameGame.CurrentStage = this; // Free Camera FreeCamera freeCamera = new FreeCamera(); freeCamera.SetView(new Vector3(0.0f, 0.0f, 10.0f), Vector3.Forward, Vector3.Up); freeCamera.SetPespective(MathHelper.PiOver4, (float)Viewer.ViewWidth, (float)Viewer.ViewHeight, 1.0f, 10000.0f); ViewCamera freeViewCamera = new ViewCamera(freeCamera, null); Viewer.AddCamera("Free", freeViewCamera); // PostScreen effect { paramCenterX = boosterEffect.Parameters["xCenter"]; paramCenterY = boosterEffect.Parameters["yCenter"]; paramTexWidth = boosterEffect.Parameters["texWidth"]; paramTexHeight = boosterEffect.Parameters["texHeight"]; paramWaveWidth = boosterEffect.Parameters["width"]; paramWaveMag = boosterEffect.Parameters["mag"]; paramBloomThreshold = postScreenEffect.Parameters["BloomThreshold"]; paramBloomIntensity = postScreenEffect.Parameters["BloomIntensity"]; paramBloomSaturation = postScreenEffect.Parameters["BloomSaturation"]; paramBaseIntensity = postScreenEffect.Parameters["BaseIntensity"]; paramBaseSaturation = postScreenEffect.Parameters["BaseSaturation"]; // Entry the post screen processing function FrameworkCore.RenderContext.RenderingPostDraw3D += OnPostDraw3DScreen; } // Tracer bullets { tracerBulletManager = new TracerBulletManager(); tracerBulletManager.AddBulletInstance(0, 32, "Particles/Spark_Horizontal01", RobotGameGame.CurrentGameLevel.SceneParticleRoot); } this.refScene3DRoot.Initialize(); // Create 2D Scene layer for Hud this.refRenderContext.CreateScene2DLayer(2); this.refSceneHudRoot = FrameworkCore.Scene2DLayers[0]; this.refSceneMissionRoot = FrameworkCore.Scene2DLayers[1]; #if DEBUG Vector2 pos = new Vector2(0, 20); pos = FrameworkCore.ClampSafeArea(pos); camPosition = FrameworkCore.TextManager.AddText(FrameworkCore.DebugFont, "CAM :", (int)pos.X, (int)pos.Y, Color.White); camPosition.Visible = true; #endif FrameworkCore.GameEventManager.Enable = true; }
public GameScene(GameInstance gameInstance) { GameInstance = gameInstance; Root = new GameSceneNode(gameInstance); }
/// <summary> /// Constructor. /// </summary> /// <param name="resourcePath">texture resource path</param> /// <param name="info">particle information structure</param> /// <param name="textureSequence">texture sequence class</param> public Particle(string resourcePath, ParticleInfo info, TextureSequence textureSequence) : base() { if (String.IsNullOrEmpty(resourcePath)) throw new ArgumentNullException("resourcePath"); if (info == null) throw new ArgumentNullException("info"); this.sequenceInfo = info; this.textureSequence = textureSequence; this.resourcePath = resourcePath; // Create particle's scene root this.sceneRoot = new GameSceneNode(); this.sceneRoot.Name = "Particle Scene Root"; AddChild(this.sceneRoot); Create(); }