public void ReloadAssets() { // Reload sidebar for (int i = 0; i < m_sidebarLevels.Length; ++i) { m_sidebarLevels[i].Tiles.RequestRebuild(); } // Reload pallette m_tileList.Reload(); var selectedDirection = SelectedTileDirection; for (int i = 0; i < m_paletteLevels.Length; ++i) { m_paletteLevels[i].Dispose(); } m_paletteLevels = new Dan200.Game.Level.Level[m_tileList.Count]; for (int i = 0; i < m_paletteLevels.Length; ++i) { m_paletteLevels[i] = new Level.Level(0, 0, 0, 1, 1, 1); m_paletteLevels[i].Info.InEditor = true; m_paletteLevels[i].Tiles.SetTile( TileCoordinates.Zero, m_tileList[i], selectedDirection, false ); } }
public Pause(NeonArkanoidGame game, Level.Level level) { _level = level; _game = game; x = -500; var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png"); background.SetOrigin(0, background.height/2); background.y = game.height/2; var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png"); header.SetOrigin(header.width/2, header.height/2); header.SetXY(background.width/2, 200); _buttons = new[] { new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width/2, 350, "Resume"), new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width/2, 450, _level.GetLevelName()), new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width/2, 550, "MainMenu") }; AddChild(background); AddChild(header); foreach (var button in _buttons) { AddChild(button); } _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav"); _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav"); }
public Vector2Int?Move(Level.Level level, LevelObject.Player player) { Vector2Int?direction = null; if (CalculateDistance(player.Location) > PlayerAwarenessDistance) { direction = RandomMove(level); } else { direction = MoveTowards(level, player.Location); if (direction == null) { direction = RandomMove(level); } } if (direction == null) { return(null); } var dir = (Vector2Int)direction; return(new Vector2Int(Location.x + dir.x, Location.y + dir.y)); }
/// <summary> /// Ends the game /// </summary> /// <param name="disconnect">If connected to server autodisconnect</param> public void EndGame(bool disconnect = true) { timersEnabled = false; StopTimers(); if (level == null) { //Stop game crashing return; } keyboardInputTimer.Tick -= KeyboardInputTimerTick; if (CommunicationManager.Instance.IsNetworked && disconnect) { MessageManager.Instance.MessageHandler -= HandleMessage; CommunicationManager.Instance.Disconnect(); } //Clear all items to prevent memory leak level = null; messageInstance = null; keyboardInputTimer = null; rotationTimer = null; cvsPlayArea.Children.Clear(); cvsExitArea.Children.Clear(); GameGridManager.Instance.ShowPath = false; GC.Collect(); }
public WaitPage(ProtagonistType pt, EnemyType et, Level.Level level) { InitializeComponent(); this.pt = pt; this.et = et; this.level = level; foreach (var ip in MessageManager.Instance.GetLocalIPs()) { txtLocalIps.Text += ip + "\n"; } MessageManager.Instance.MessageHandler += StartHandler; Loaded += (s, e) => { //Create a thread to waiting until a start message has been received without blocking //the ui thread waitingThread = new Thread(new ThreadStart(() => { //Wait until the start message has been received while (!gameStarted) { Thread.Sleep(1000); } //Start the game MessageManager.Instance.MessageHandler -= StartHandler; TopFrameManager.Instance.MainFrame.Dispatcher.Invoke(new Action(() => { GamePage gp = new GamePage(pt, et, level); TopFrameManager.Instance.MainFrame.Navigate(gp); })); })); waitingThread.Start(); }; }
public Pause(NeonArkanoidGame game, Level.Level level) { _level = level; _game = game; x = -500; var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png"); background.SetOrigin(0, background.height / 2); background.y = game.height / 2; var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png"); header.SetOrigin(header.width / 2, header.height / 2); header.SetXY(background.width / 2, 200); _buttons = new[] { new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width / 2, 350, "Resume"), new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width / 2, 450, _level.GetLevelName()), new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width / 2, 550, "MainMenu") }; AddChild(background); AddChild(header); foreach (var button in _buttons) { AddChild(button); } _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav"); _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav"); }
public Level.Level Build() { Level.Level result = new Level.Level(Width, Height, new EnemySpawnRateContainer().Init()); var width = Width / 2; var height = Height / 2; for (int x = (width * -1); x < width; x++) { for (int y = (height * -1); y < height; y++) { var enemyTypeToSpawn = FindEnemyTypeToSpawn(result); switch (enemyTypeToSpawn) { case EnemyType.None: result.Tiles.Add(new Tile(new Vector2(x, y), null, TileRenderer)); break; case EnemyType.Obstacle: result.Tiles.Add(new Tile(new Vector2(x, y), enemySpawner.Spawn(enemyTypeToSpawn, new Vector2(x, y), 0.5f), TileRenderer)); break; default: result.Tiles.Add(new Tile(new Vector2(x, y), enemySpawner.Spawn(enemyTypeToSpawn, new Vector2(x, y)), TileRenderer)); break; } } } return(result); }
public ControlPoint() { Level = new Level.Level(LevelWidth, LevelHeight); Algorithms = new Generation.AlgorithmComboBoxValues(); GameObjectFactory = new Generation.GameObjectFactory(); MethodFactory = new Generation.MethodFactory(); Generator = new Generation.Generator(); }
public void Initialize(Level.Level level, Transform playerTransform) { this.playerTransform = playerTransform; this.level = level; wallSpriteDictionary.Clear(); PopulateWalls(); PopulateWallNames(); }
/// <summary> /// Constructor /// </summary> /// <param name="game">Game reference</param> /// <param name="level">Level reference</param> public Ball(Game game, Level.Level level) : base(game) { this.Level = level; this.Size = GameSettings.Instance.BallSize; ((CollisionManager)game.Services.GetService(typeof(CollisionManager))).Register(this); }
protected override void OnPostShutdown() { if (m_level != null) { m_level.Dispose(); m_level = null; } }
/// <summary> /// /// </summary> /// <param name="game"></param> /// <param name="player"></param> public DeadZone(Game game, Level.Level level, Player player) : base(game) { this.Player = player; this.Level = level; this.Visible = false; ((CollisionManager)game.Services.GetService(typeof(CollisionManager))).Register(this); }
/// <summary> /// Create a new Kitty III. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public Kitty3(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(1100, 300); this.HP = 25; this.MaxHP = 25; this.Scale = 1f; this.Texture = KittyTexture; this.CollisionBoxRadius = 30; }
public RoundSystem(Level.Level level) { currentRound = 1; myLevel = level; started = false; instance = this; InvokeRoundChange(); }
/// <summary> /// Create a new instance of the final boss.. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public Bella(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(-200, 350); this.HP = 200; this.MaxHP = 200; this.Scale = 1f; this.Texture = BellaTexture; this.CollisionBoxRadius = 40; }
/// <summary> /// Create a new Shooter Fish. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> /// <param name="y">The Y position of the enemy.</param> public ShooterFish(Level.Level AssociatedLevel, int y) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(1124, y); this.HP = 2; this.MaxHP = 2; this.Scale = 1f; this.Texture = ShooterFishTexture; this.CollisionBoxRadius = 25f; }
/// <summary> /// Create a new Tracking Shooter Fish III. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> /// <param name="x">The X position of the enemy.</param> /// <param name="y">The Y position of the enemy.</param> public TrackingShooterFish3(Level.Level AssociatedLevel, int x, int y) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(x, y); this.HP = 3; this.MaxHP = 3; this.Scale = 1f; this.Texture = TrackingShooterFish3Texture; this.CollisionBoxRadius = 25f; }
/// <summary> /// Create a new Smiley. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> /// <param name="x">The X position of the enemy.</param> /// <param name="y">The Y position of the enemy.</param> public Smiley(Level.Level AssociatedLevel, int x, int y) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(x, y); this.HP = 5; this.MaxHP = 5; this.Scale = 1f; this.Texture = SmileyTexture; this.CollisionBoxRadius = 20f; }
/// <summary> /// Create a new Cloud enemy. /// </summary> /// <param name="AssociatedLevel">The pointer to the level that this enemy belongs to.</param> /// <param name="Position">The starting position of the cloud enemy.</param> public Cloud(Level.Level AssociatedLevel, Vector2 Position) { this.AssociatedLevel = AssociatedLevel; this.Position = Position; this.HP = 2; this.MaxHP = 2; this.Scale = 1f; this.Texture = CloudTexture; this.CollisionBoxRadius = 20f; }
/// <summary> /// Create a new Kitty I. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public Kitty1(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(512, 0); this.HP = 35; this.MaxHP = 35; this.Scale = 1f; this.Texture = KittyTexture; this.CollisionBoxRadius = 30f; }
/// <summary> /// Create a new Evil Eel II. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> /// <param name="x">The X position of the enemy.</param> /// <param name="y">The Y position of the enemy.</param> public EvilEel2(Level.Level AssociatedLevel, int x, int y) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(x, y); this.HP = 6; this.MaxHP = 6; this.Scale = 1f; this.Texture = EvilEel2Texture; this.CollisionBoxRadius = 10f; }
/// <summary> /// Create a new Spike. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public Spike(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(1300, 350); this.HP = 300; this.MaxHP = 300; this.Scale = 1f; this.Texture = SpikeTexture; this.CollisionBoxRadius = 40; }
/// <summary> /// Create a new Mike Peterson. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public MikePeterson(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(1300, 350); this.HP = 300; this.MaxHP = 300; this.Scale = 1f; this.Texture = MikePetersonTexture; this.CollisionBoxRadius = 50; }
/// <summary> /// Create a new Ultimate Blocky. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> public UltimateBlocky(Level.Level AssociatedLevel) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(1124, Player.Sprite.Y); this.HP = 100; this.MaxHP = 100; this.Scale = 1f; this.Texture = UltimateCytopodTexture; this.CollisionBoxRadius = 50f; }
/// <summary> /// Create a new Seahorse. /// </summary> /// <param name="AssociatedLevel">The level in which this enemy exists.</param> /// <param name="x">The X position of the enemy.</param> /// <param name="y">The Y position of the enemy.</param> public Seahorse(Level.Level AssociatedLevel, int x, int y) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(x, y); this.HP = 3; this.MaxHP = 3; this.Scale = 1f; this.Texture = SeahorseTexture; this.CollisionBoxRadius = 25f; }
/// <summary> /// Create a new Horizontal Saucer. /// </summary> /// <param name="AssociatedLevel">The level that the enemy appears in.</param> /// <param name="Position">The position of the enemy.</param> /// <param name="StartingX">The intial X-position.</param> /// <param name="TwoWay">Indicate whether the saucer shoots both ways or not.</param> public HorizontalSaucer(Level.Level AssociatedLevel, Vector2 Position, int StartingX, bool TwoWay) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(StartingX, Position.Y); this.IntendedX = Position.X; this.HP = 8; this.MaxHP = 8; this.Scale = 1f; this.Texture = SaucerTexture; this.CollisionBoxRadius = 20f; this.TwoWay = TwoWay; }
public TileSelect(Game.Game game, Tile tile) { m_game = game; m_level = new Level.Level(0, 0, 0, 1, 1, 1); m_level.Info.InEditor = true; m_level.Tiles.SetTile( TileCoordinates.Zero, tile, FlatDirection.South, false ); }
/// <summary> /// Create a new Verticle Saucer. /// </summary> /// <param name="AssociatedLevel">The level in which the enemy appears.</param> /// <param name="Position">The position of the enemy.</param> /// <param name="StartingY">The initial Y-position.</param> /// <param name="TwoWay">Indicate whether the enemy will fire both ways or not.</param> public VerticalSaucer(Level.Level AssociatedLevel, Vector2 Position, int StartingY, bool TwoWay) { this.AssociatedLevel = AssociatedLevel; this.Position = new Vector2(Position.X, StartingY); this.IntendedY = Position.Y; this.HP = 8; this.MaxHP = 8; this.Scale = 1f; this.Texture = SaucerTexture; this.CollisionBoxRadius = 20f; this.TwoWay = TwoWay; }
private Vector3 GetCentre(Level.Level level) { // Look for camera targets, or the lowest floor tile int?lowestPlacement = null; var cameraTargetSum = Vector3.Zero; var numCameraTargets = 0.0f; for (int x = level.Tiles.MinX; x < level.Tiles.MaxX; ++x) { for (int y = level.Tiles.MinY; y < level.Tiles.MaxY; ++y) { for (int z = level.Tiles.MinZ; z < level.Tiles.MaxZ; ++z) { var coords = new TileCoordinates(x, y, z); var tile = level.Tiles[coords]; if (tile.IsCameraTarget(level, coords)) { var baseCoords = level.Tiles[coords].GetBase(level, coords); cameraTargetSum += new Vector3((float)baseCoords.X + 0.5f, (float)baseCoords.Y * 0.5f, (float)baseCoords.Z + 0.5f); numCameraTargets++; } else if (tile.AllowPlacement) { var above = coords.Move(Direction.Up, tile.Height); if (!lowestPlacement.HasValue || above.Y < lowestPlacement.Value) { var aboveTile = level.Tiles[above]; if (tile.IsSolidOnSide(level, coords, Direction.Up) && aboveTile.IsReplaceable(level, above)) { lowestPlacement = above.Y; } } } } } } if (numCameraTargets > 0) { // Use the average of the camera targets return(cameraTargetSum / (float)numCameraTargets); } // Use the geometric center of the lowest placeable layer var floor = lowestPlacement.HasValue ? lowestPlacement.Value : level.Tiles.MinY + 1; return(new Vector3( (float)level.Tiles.MinX + (float)level.Tiles.Width * 0.5f, 0.5f * (float)floor, (float)level.Tiles.MinZ + (float)level.Tiles.Depth * 0.5f )); }
private void UpdateLighting(Level.Level level) { if (m_game.Sky != null) { level.Lights.AmbientLight.Colour = m_game.Sky.AmbientColour; level.Lights.SkyLight.Active = (m_game.Sky.LightColour.LengthSquared > 0.0f); level.Lights.SkyLight.Colour = m_game.Sky.LightColour; level.Lights.SkyLight.Direction = m_game.Sky.LightDirection; level.Lights.SkyLight2.Active = (m_game.Sky.Light2Colour.LengthSquared > 0.0f); level.Lights.SkyLight2.Colour = m_game.Sky.Light2Colour; level.Lights.SkyLight2.Direction = m_game.Sky.Light2Direction; } }
public Polygon(Vec2[] points, uint color, Level.Level level, int id, float realPosX, float realPosY) { _points = points; _realPosX = realPosX; _realPosY = realPosY; _level = level; _color = color; _id = id; DrawOnCanvas(); _lines = new LineSegment[_points.Length]; CreateLines(); foreach (var line in _lines) _level.AddChild(line); }
/// <summary> /// Initializes Screen /// </summary> public override void Initialize() { base.Initialize(); _level = new Level.Level(this.Game, this); _level.Initialize(); this.Water = new WaterEffect(Game, this.ScreenManager.ScreenWidth, this.ScreenManager.ScreenHeight); this.Water.Initialize(); this.TransitionOnTime = TimeSpan.FromSeconds(.5f); this.TransitionOffTime = TimeSpan.FromSeconds(.5f); }
public StateGame(string pStateName) : base(pStateName) { this.OnCreate += new EntityEventHandler(this.Event_OnCreate); this.OnDestroy += new EntityEventHandler(this.Event_OnDestroy); // Make a basic level object for the time being. m_GameLevel = new Level.Level(16, 16, Main.INSTANCE.Sprites["terrain_tiles"], 64, 64); m_CameraManager = new CameraManager(); m_CameraManager.AddCamera(new Camera(new Vector2(0,0))); this.Initialise(); }
public GameplayState(GameStateManager gameStateManager, GraphicsDevice graphicsDevice) : base(gameStateManager) { level = new Level.Level(MoveToWinState, MoveToTieState); scoreRenderer = new ScoreRenderer(); //Create the render target to the level size //Initialise it with Bgr565 (no need for alpha) and no mipmap or depth buffer levelRenderTarget = new RenderTarget2D(graphicsDevice, GlobalGameData.levelSizeX, GlobalGameData.levelSizeY, false, SurfaceFormat.Bgr565, DepthFormat.None); this.graphicsDevice = graphicsDevice; playerInputTypes = new int[4]; songList = new Song[5]; }
public LevelManager(Game game, string player_texture_name, Vector2 player_start_position, String level_one_tile_sheet, String level_one_sheet) : base(game) { //first open a stream to the level sheet Stream level_one_sheet_stream = TitleContainer.OpenStream("Content\\"+level_one_sheet); //Stream level_one_sheet_stream = new FileStream((level_one_sheet), FileMode.Open); //now open the player texture Texture2D player_texture = game.Content.Load<Texture2D>(player_texture_name); levels = new List<Level.Level>(); //add the first level to list levels.Add(new Level.Level(game, player_texture, player_start_position, level_one_tile_sheet, level_one_sheet_stream)); current_level = new Level.Level(game, player_texture, player_start_position, level_one_tile_sheet, level_one_sheet_stream); }
public Paddle(Level.Level level, Vec2 position = null) : base("../assets/sprite/player/player.png", 13, 1) { SetOrigin(width/2, 0); _level = level; _position = position; if (UtilitySettings.DebugMode) alpha = 0; if (Position != null) { x = Position.x; y = Position.y; } CreateLines(); CreateLimit(); }
/// <summary> /// Constructor /// </summary> /// <param name="level">Level reference</param> public HeadsUpDisplayPopup(Level.Level level) { _level = level; }
public PauseScreen(Level.Level level) { _level = level; _level.Screen.Exiting += new EventHandler(Screen_Exiting); }