public TestGround() { Graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Handler = new SceneHandler(); FrameRateCounter = new FrameRateCounter(); IsMouseVisible = true; }
public RougeSpyGameScene(SceneHandler handler, string name, IConnector connector, GraphicsDeviceManager graphicsDeviceManager) : base(handler, name, connector, graphicsDeviceManager) { //movement system MainSystem.UpdateComplexSystem.AddSubSystem(new InputUpdateSystem(MainSystem)); MainSystem.UpdateComplexSystem.AddSubSystem(new CalculateMovementUpdateSystem(MainSystem)); MainSystem.UpdateComplexSystem.AddSubSystem(new HitBoxCollisionUpdateSystem(MainSystem)); MainSystem.UpdateComplexSystem.AddSubSystem(new ApplyMovementUpdateSystem(MainSystem)); MainSystem.UpdateComplexSystem.AddSubSystem(new HitBoxUpdateSystem(MainSystem)); //render system MainSystem.RenderComplexSystem.AddSubSystem(new Texture2DRenderSystem(MainSystem)); MainSystem.RenderComplexSystem.AddSubSystem(new HitBoxRenderSystem(MainSystem, 2)); //Player PlayerID = MainSystem.CreateEntityID(); MainSystem.GetUpdateSystem<InputUpdateSystem>().CreateInputNode(PlayerID, new GamePadInput()); MainSystem.GetUpdateSystem<CalculateMovementUpdateSystem>().CreateMovementNode(PlayerID); MainSystem.GetUpdateSystem<ApplyMovementUpdateSystem>().CreateMovementNode(PlayerID); MainSystem.GetComponent<Motion2DComponent>(PlayerID).Acceleration = 0.2f; MainSystem.GetComponent<Motion2DComponent>(PlayerID).Decceleration = 0.3f; MainSystem.GetComponent<Motion2DComponent>(PlayerID).MaxSpeed = 10.0f; Texture2D texture = AssetLoader.Instance.Load<Texture2D>("Player_Alpha_64_43"); MainSystem.GetRenderSystem<Texture2DRenderSystem>().CreateTexture2DRenderNode(PlayerID, texture); MainSystem.GetComponent<Position2DComponent>(PlayerID).Position = new Vector2(200); MainSystem.GetComponent<Position2DComponent>(PlayerID).Origin = new Vector2(texture.Width / 2, texture.Height / 2); List<Vector2> points = new List<Vector2>(); points.Add(Vector2.Zero); points.Add(new Vector2(texture.Width - 24, 0)); points.Add(new Vector2(texture.Width - 24, texture.Height)); points.Add(new Vector2(0, texture.Height)); MainSystem.GetUpdateSystem<HitBoxUpdateSystem>().CreateHitBoxNode(PlayerID, points); MainSystem.GetComponent<HitBox2DComponent>(PlayerID).Offset = new Vector2(12, 0); MainSystem.GetUpdateSystem<HitBoxCollisionUpdateSystem>().CreateHitBoxCollisionUpadateNode(PlayerID, points, new PositionCorrectionHitBoxIntersectionReaction(MainSystem, PlayerID)); MainSystem.GetRenderSystem<HitBoxRenderSystem>().CreateHitBoxRenderNode(PlayerID, points); string[][] blueprint = new string[3][]; blueprint[0] = new string[] { "w", "w", "w" }; blueprint[1] = new string[] { "w", " ", "w" }; blueprint[2] = new string[] { "w", "w", "w" }; List<Vector2> hitBoxOutline = new List<Vector2>(); hitBoxOutline.Add(new Vector2(0, 0)); hitBoxOutline.Add(new Vector2(64, 0)); hitBoxOutline.Add(new Vector2(64, 64)); hitBoxOutline.Add(new Vector2(0, 64)); List<TileBluePrint> tileBluePrints = new List<TileBluePrint>(); tileBluePrints.Add(new TileBluePrint("w", AssetLoader.Instance.Load<Texture2D>("WoodenTileA"), hitBoxOutline)); TileMapBluePrint tileMapBluePrint = new TileMapBluePrint(blueprint, tileBluePrints, new Vector2(64,64)); TileMapLoader.Load(tileMapBluePrint, MainSystem); }
public Scene(SceneHandler handler, string name, IConnector connector, GraphicsDeviceManager graphicsDeviceManager, List<Scene> children) { Handler = handler; Name = name; Connector = connector; GraphicsDeviceManager = graphicsDeviceManager; if (connector != null) { Connector.Next = this; } Children = children; }
public Scene(SceneHandler handler, string name, IConnector connector, GraphicsDeviceManager graphicsDeviceManager) : this(handler, name, connector, graphicsDeviceManager, new List<Scene>()) { }