private static bool GetTileFromBoolMap(bool[,] map, Vector2 pos, Walls walls) { int x = (int)pos.X, y = (int)pos.Y; if (x >= 0 && y >= 0 && x < map.GetLength(0) && y < map.GetLength(1)) { return(map[x, y]); } else if (x < 0 && (walls & Walls.West) != Walls.None) { return(true); } else if (y < 0 && (walls & Walls.North) != Walls.None) { return(true); } else if (x >= map.GetLength(0) && (walls & Walls.East) != Walls.None) { return(true); } else if (y >= map.GetLength(1) && (walls & Walls.South) != Walls.None) { return(true); } return(false); }
/// <summary> /// Removes a light /// </summary> /// <param name="Wall">Handle</param> public void RemoveWall(Wall wall) { if (Walls.Contains(wall)) { Walls.Remove(wall); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { var screenBounds = GraphicsDevice.Viewport.Bounds; if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } var touchState = Keyboard.GetState(); if (touchState.IsKeyDown(Keys.Left)) { PaddleBottom.X = PaddleBottom.X - (float)(PaddleBottom.Speed * gameTime.ElapsedGameTime.TotalMilliseconds); PaddleBottom.X = MathHelper.Clamp(PaddleBottom.X, screenBounds.Left, screenBounds.Right - PaddleBottom.Width); } if (touchState.IsKeyDown(Keys.Right)) { PaddleBottom.X = PaddleBottom.X + (float)(PaddleBottom.Speed * gameTime.ElapsedGameTime.TotalMilliseconds); PaddleBottom.X = MathHelper.Clamp(PaddleBottom.X, screenBounds.Left, screenBounds.Right - PaddleBottom.Width); } if (touchState.IsKeyDown(Keys.A)) { PaddleTop.X = PaddleTop.X - (float)(PaddleTop.Speed * gameTime.ElapsedGameTime.TotalMilliseconds); PaddleTop.X = MathHelper.Clamp(PaddleTop.X, screenBounds.Left, screenBounds.Right - PaddleTop.Width); } if (touchState.IsKeyDown(Keys.D)) { PaddleTop.X = PaddleTop.X + (float)(PaddleTop.Speed * gameTime.ElapsedGameTime.TotalMilliseconds); PaddleTop.X = MathHelper.Clamp(PaddleTop.X, screenBounds.Left, screenBounds.Right - PaddleTop.Width); } var ballPositionChange = Ball.Direction * (float)(gameTime.ElapsedGameTime.TotalMilliseconds * Ball.Speed); Ball.X += ballPositionChange.X; Ball.Y += ballPositionChange.Y; // Ball - side walls if (Walls.Any(w => CollisionDetector.Overlaps(Ball, w))) { Ball.Direction = Ball.Direction * new Vector2(-1, 1); Ball.Speed = Ball.Speed * Ball.BumpSpeedIncreaseFactor; } // Ball - winning walls if (Goals.Any(w => CollisionDetector.Overlaps(Ball, w))) { Ball.X = screenBounds.Center.ToVector2().X; Ball.Y = screenBounds.Center.ToVector2().Y; Ball.Speed = GameConstants.DefaultInitialBallSpeed; HitSound.Play(); } // Paddle - ball collision if (CollisionDetector.Overlaps(Ball, PaddleTop) && Ball.Direction.Y < 0 || (CollisionDetector.Overlaps(Ball, PaddleBottom) && Ball.Direction.Y > 0)) { Ball.Direction = Ball.Direction * new Vector2(1, -1); Ball.Speed *= Ball.BumpSpeedIncreaseFactor; } base.Update(gameTime); }
private GameObject WallFromDirection(Walls wallScript, WallDirections wallDirection) { if (!wallScript) { return(null); } switch (wallDirection) { case WallDirections.North: return(wallScript.wallN); case WallDirections.East: return(wallScript.wallE); case WallDirections.South: return(wallScript.wallS); case WallDirections.West: return(wallScript.wallW); default: return(null); } }
private bool WallCheck() { var updated = false; var me = Core.Me.Location; if (_walls == null) { return(false); } if (_walls.Count < 1) { return(false); } foreach (var id in _walls.Where(i => i.Value[0].Distance2D(Core.Me.Location) < 50 && !Walls.ContainsKey(i.Key) && !activeWalls.Contains(i.Key))) { var wall1 = id.Value[1]; wall1.Y -= 2; wallList.Add(new BoundingBox3 { Min = wall1, Max = id.Value[2] }); Walls.Add(id.Key, true); updated = true; } //Logger.Info($"[walls] {string.Join(", ", _hit.Keys)}"); return(updated); }
public Coordinates GetDestination(Direction direction, int x, int y) { switch (direction) { case Direction.Up: y--; break; case Direction.Right: x++; break; case Direction.Down: y++; break; case Direction.Left: x--; break; default: return(new Coordinates(x, y)); } // destination is wall var isWall = Walls.Any(w => w.X == x && w.Y == y); // destination out of map var isOut = x >= Width || x < 0 || y >= Height || y < 0; return(new Coordinates(x, y, isWall, isOut)); }
private void CreateApple(int percent) { if (Apples.Count < appleCount && rnd.Next(100) <= percent) { int x = rnd.Next(view.MapWidth - BlockSize); int y = rnd.Next(view.MapHeight - BlockSize); var apple = new AppleViewModel(x, y, 12, 12); if (Player != null) { if (Walls.Find(wall => IsCollision(wall, apple)) == null && IsCollision(Player, apple) == false) { Apples.Add(apple); } } else { if (Walls.Find(wall => IsCollision(wall, apple)) == null && IsCollision(reservePlayer, apple) == false) { Apples.Add(apple); } } } }
public override bool Equals(object obj) { return(this == obj || obj is SokobanMap map && Walls.All(map.Walls.Contains) && Objectives.All(map.Objectives.Contains)); }
protected override void OnCantMove <T>(T component) { Walls hitWall = component as Walls; hitWall.DamageWall(wallDamage); anim.SetTrigger("Chop"); }
private void CreateTank(int percent) { if (Tanks.Count < tankCount && rnd.Next(100) <= percent) { int x = rnd.Next(view.MapWidth - BlockSize); int y = rnd.Next(view.MapHeight - BlockSize); var tank = new TankViewModel(x, y, 16, 16, (Direction)rnd.Next(4)); if (Player != null) { if (Walls.Find(wall => IsCollision(wall, tank)) == null && IsCollision(Player, tank) == false && Tanks.Find(tnk => tnk != tank ? IsCollision(tnk, tank) : false) == null) { Tanks.Add(tank); } } else { if (Walls.Find(wall => IsCollision(wall, tank)) == null && IsCollision(reservePlayer, tank) == false && Tanks.Find(tnk => tnk != tank ? IsCollision(tnk, tank) : false) == null) { Tanks.Add(tank); } } } }
private IEnumerator FuseWalls(float maxTarget) { float loopStartTime = Time.realtimeSinceStartup; float timeTaken; for (int i = 0; i < mazeX; i++) { for (int j = 0; j < mazeY; j++) { Walls currentWallPiece = piecesArray[i][j].GetComponent <Walls>(); currentWallPiece.FuseAllWallsInLine(); Destroy(currentWallPiece.gameObject); timeTaken = Time.realtimeSinceStartup - loopStartTime; if (timeTaken > maxTarget) { yield return(null); loopStartTime = Time.realtimeSinceStartup; } } } wallsFused = true; Debug.Log("Walls fused"); }
public void MakeTurn() { foreach (var creature in Alive.Where(c => c != Player)) { creature.MakeAutoTurn(); } foreach (var projectile in _projectiles) { projectile.Move(); var projectileRect = projectile.ToRectangle(); foreach (var creature in Alive.Where(creature => projectile.Side != creature.Side && Geometry.CheckRectangleIntersection(projectileRect, creature.ToRectangle()))) { creature.TakeDamage(projectile.Damage); projectile.Collide(); break; } foreach (var dummy in Walls.Where(wall => Geometry.CheckRectangleIntersection(wall.ToRectangle(), projectileRect))) { projectile.Collide(); } } _projectiles.RemoveWhere(p => p.Live <= 0); _aliveCreatures.RemoveWhere(c => !c.IsAlive); Player.MakeTurn(PlayersTurn); PlayersTurn = Turn.None; }
private ComputerSnake GetRandomComputerSnake() { Color headColor = Color.FromArgb(rng.Next(256), rng.Next(256), rng.Next(256)); Color bodyColor = Color.FromArgb(rng.Next(256), rng.Next(256), rng.Next(256)); Array directionValues = Enum.GetValues(typeof(Direction)); Direction startDirection = (Direction)directionValues.GetValue(rng.Next(directionValues.Length)); while (startDirection == Direction.None) { startDirection = (Direction)directionValues.GetValue(rng.Next(directionValues.Length)); } int x = rng.Next(2, Width - 1); int y = rng.Next(2, Height - 1); while (Walls.Any(w => w.X == x && w.Y == y)) { x = rng.Next(2, Width - 1); y = rng.Next(2, Height - 1); } ComputerSnake randomComputerSnake = new ComputerSnake(x, y, startDirection, headColor, bodyColor); return(randomComputerSnake); }
private void CreateInterior() { Walls.Add(new Wall(30, 0, 390, 30)); Walls.Add(new Wall(90, 60, 60, 30)); Walls.Add(new Wall(180, 60, 90, 30)); Walls.Add(new Wall(300, 60, 60, 30)); Walls.Add(new Wall(120, 120, 90, 30)); Walls.Add(new Wall(240, 120, 90, 30)); Walls.Add(new Wall(30, 180, 60, 30)); Walls.Add(new Wall(150, 180, 60, 30)); Walls.Add(new Wall(240, 180, 60, 30)); Walls.Add(new Wall(360, 180, 60, 30)); Walls.Add(new Wall(30, 240, 60, 30)); Walls.Add(new Wall(150, 240, 150, 30)); Walls.Add(new Wall(360, 240, 60, 30)); Walls.Add(new Wall(120, 300, 90, 30)); Walls.Add(new Wall(240, 300, 90, 30)); Walls.Add(new Wall(90, 360, 60, 30)); Walls.Add(new Wall(180, 360, 90, 30)); Walls.Add(new Wall(300, 360, 60, 30)); Walls.Add(new Wall(30, 420, 390, 30)); Walls.Add(new Wall(0, 0, 30, 210)); Walls.Add(new Wall(0, 240, 30, 210)); Walls.Add(new Wall(60, 60, 30, 90)); Walls.Add(new Wall(60, 300, 30, 90)); Walls.Add(new Wall(120, 180, 30, 90)); Walls.Add(new Wall(300, 180, 30, 90)); Walls.Add(new Wall(360, 60, 30, 90)); Walls.Add(new Wall(360, 300, 30, 90)); Walls.Add(new Wall(420, 0, 30, 210)); Walls.Add(new Wall(420, 240, 30, 210)); }
protected bool[,] DiscoverTile(float x, float y, Entity entityRef, int perception, bool[,] visionRef) { bool[,] vision = visionRef; float oX = entityRef.WorldPosition.x + 0.5f; float oY = entityRef.WorldPosition.y + 0.5f; int arrayX = vision.GetLength(0); int arrayY = vision.GetLength(1); for (int i = 0; i < perception; i++) { if (oX < 0.0f || oY < 0.0f || oX >= arrayX || oY >= arrayY) { return(vision); } int posX = (int)oX; int posY = (int)oY; vision[posX, posY] = true; if (Walls.ContainsKey(new Vector2Int(posX, posY))) { return(vision); } oX += x; oY += y; } return(vision); }
public override void _Ready() { base._Ready(); GD.Randomize(); Items.Hide(); var gateId = Walls.TileSet.FindTileByName("gate"); foreach (var cell in Walls.GetUsedCellsById(gateId)) { gates.Add(cell); } SpawnItems(); Player.Connect(nameof(Player.Dead), this, nameof(OnGameOver)); Player.Connect(nameof(Player.Win), this, nameof(OnPlayerWin)); Player.Connect(nameof(Player.Moved), this, nameof(OnPlayerMoved)); Global.Instance.Connect(nameof(Global.LifeChanged), HUD, nameof(HUD.UpdateHealth)); Global.Instance.Connect(nameof(Global.KeysChanged), HUD, nameof(HUD.UpdateKeys)); HUD.UpdateKeys(); HUD.UpdateHealth(); }
public bool WallCheck() { bool updated = false; Vector3 me = Core.Me.Location; wallList.Clear(); if (_walls == null) { return(false); } foreach (KeyValuePair <uint, List <Vector3> > id in _walls.Where(i => i.Value[0].Distance2D(Core.Me.Location) < 5 && !Walls.ContainsKey(i.Key) && !_activeWalls.Contains(i.Key))) { Vector3 wall1 = id.Value[1]; wall1.Y -= 5; Vector3 wall2 = id.Value[2]; wall2.Y -= 10; wallList.Add(new BoundingBox3 { Min = wall1, Max = wall2 }); Walls.Add(id.Key, true); updated = true; } //Logger.Debug($"[walls] {string.Join(", ", _hit.Keys)}"); return(updated); }
public void Draw(RenderTarget target, RenderStates states) { target.Draw(Shape); foreach (Field[] fields in Fields) { foreach (Field field in fields) { target.Draw(field); } } Walls.ForEach((Wall wall) => target.Draw(wall)); foreach (RectangleShape border in Borders) { target.Draw(border); } target.Draw(FoodBar); target.Draw(CoinBar); if (Agent.Food <= 0) { target.Draw(RestartText); } }
private void AssembleMap() { Map = new List <List <Piece> >(); for (int y = 0; y < Height; y++) { Map.Add(new List <Piece>()); for (int x = 0; x < Width; x++) { if (Walls.Any(p => p.X == x && p.Y == y)) { Map[y].Add(new Piece(x, y, PieceType.Wall, Color.Blue)); } else if (Snakes.Any(s => s.snakePieces.Any(p => p.X == x && p.Y == y && p.Type == PieceType.SnakePiece))) { Map[y].Add(new Piece(x, y, PieceType.SnakePiece, Snakes.Where(s => s.IsAtPos(x, y)).FirstOrDefault().snakePieces.Where(p => p.X == x && p.Y == y).FirstOrDefault().Color)); } else if (Snakes.Any(s => s.snakePieces.Any(p => p.X == x && p.Y == y && p.Type == PieceType.HeadPiece))) { Map[y].Add(new Piece(x, y, PieceType.HeadPiece, Snakes.Where(s => s.IsAtPos(x, y)).FirstOrDefault().snakePieces.Where(p => p.X == x && p.Y == y).FirstOrDefault().Color)); } else if (FoodPieces.Any(p => p.X == x && p.Y == y)) { Piece piece = FoodPieces.Where(p => p.X == x && p.Y == y).FirstOrDefault(); Map[y].Add(piece); } else { Map[y].Add(new Piece(x, y, PieceType.Empty)); } } } }
private void CreateWalls() { // Right wall Walls.Add(new Wall( new Vector2D(Width / 2, 0), Depth, 2 )); // Back wall Walls.Add(new Wall( new Vector2D(0, Depth / 2), Width, 3 )); // Left wall Walls.Add(new Wall( new Vector2D(-Width / 2, 0), Depth, 0 )); // Front wall Walls.Add(new Wall( new Vector2D(0, -Depth / 2), Width, 1 )); }
public override string ToString() { StringBuilder sb = new StringBuilder(); StringBuilder sbCreatures = new StringBuilder(); for (int y = 0; y < BoundingRect.Height; y++) { for (int x = 0; x < BoundingRect.Width; x++) { Point p = new Point(x, y); if (Walls.Contains(p)) { sb.Append("#"); } else if (Creatures.ContainsKey(p)) { sb.Append(Creatures[p].Symbol); sbCreatures.Append($"{Creatures[p].Symbol}({Creatures[p].HitPoints}),"); } else { sb.Append("."); } } sb.Append("\t"); sb.Append(sbCreatures); sbCreatures.Clear(); sb.Append("\n"); } //foreach (var kvp in Creatures) sb.Append($"{kvp.Key} ({kvp.Value.Symbol}): HP {kvp.Value.HitPoints}\n"); return(sb.ToString()); }
private void SetWalls(double PlayerAndWallSkin)//generate Walls { //set three rows of walls for (int row = 0; row < 3; row++) { //set six walls per row for (int wallPerRow = 0; wallPerRow < 6; wallPerRow++) { //set five wallBlocks for (int wallStack = 0; wallStack < 5; wallStack++) { //new object of the type Wall Wall w = new Wall(GameDisplay) { X = wallPerRow * (20 + 1) + (wallStack * 730 / 5) + 15, Y = row * 20 + 550 }; Walls.Add(w); switch (PlayerAndWallSkin)//instanciates a new Image foreach Wall { case 0: w.Reci.Fill = new ImageBrush(new BitmapImage(new Uri("Images/Walls/WallRed.PNG", UriKind.Relative))); break; case 1: w.Reci.Fill = new ImageBrush(new BitmapImage(new Uri("Images/Walls/WallGreen.PNG", UriKind.Relative))); break; case 2: w.Reci.Fill = new ImageBrush(new BitmapImage(new Uri("Images/Walls/WallBlue.PNG", UriKind.Relative))); break; case 3: w.Reci.Fill = new ImageBrush(new BitmapImage(new Uri("Images/Walls/WallYellow.PNG", UriKind.Relative))); break; } } } } }
public void Generate() { KD.SDK.SceneEnum.ViewMode currentViewMode = _buildCommon.GetView(); Articles articles = this.CurrentAppli.GetArticleList(FilterArticle.FilterToGetWallByValid()); if (articles != null && articles.Count > 0) { Walls walls = new Walls(articles); foreach (Wall wall in walls) { Articles articlesAgainst = wall.AgainstMeASC; if (articlesAgainst != null && articlesAgainst.Count > 0) { wall.IsActive = true; _buildCommon.SetView(KD.SDK.SceneEnum.ViewMode.VECTELEVATION); _buildCommon.ZoomAdjusted(); _buildCommon.ExportImageJPG(walls.IndexOf(wall) + 1, OrderTransmission.ElevName); } } _buildCommon.SetView(currentViewMode); } }
public void Boot() { Rooms = new List <Room>(); Room mainRoom = new Room(new PointF(0, 0), new PointF(750, 450)); mainRoom.isMainRoom = true; mainRoom.AddDoor(Room.DoorPosition.Right, 50); Room room1 = new Room(new PointF(0, 0), new PointF(150, 150)); room1.AddDoor(Room.DoorPosition.Down, 50); Room room2 = new Room(new PointF(150, 0), new PointF(300, 150)); room2.AddDoor(Room.DoorPosition.Down, 50); Room room3 = new Room(new PointF(500, 0), new PointF(750, 150)); room3.AddDoor(Room.DoorPosition.Down, 50); Room room4 = new Room(new PointF(0, 300), new PointF(150, 450)); room4.AddDoor(Room.DoorPosition.Right, 50); Room room5 = new Room(new PointF(300, 300), new PointF(550, 450)); room5.AddDoor(Room.DoorPosition.Left, 50); Room room6 = new Room(new PointF(550, 300), new PointF(750, 450)); room6.AddDoor(Room.DoorPosition.Up, 50); Rooms.Add(mainRoom); Rooms.Add(room1); Rooms.Add(room2); Rooms.Add(room3); Rooms.Add(room4); Rooms.Add(room5); Rooms.Add(room6); EmergencyCheckpoint ec6 = new EmergencyCheckpoint(new PointF(750, 225), null); EmergencyCheckpoint ec5 = new EmergencyCheckpoint(new PointF(640, 225), ec6); EmergencyCheckpoint ec4 = new EmergencyCheckpoint(new PointF(400, 215), ec5); EmergencyCheckpoint ec3 = new EmergencyCheckpoint(new PointF(225, 225), ec4); EmergencyCheckpoint ec2 = new EmergencyCheckpoint(new PointF(75, 225), ec3); EmergencyCheckpoint ec1 = new EmergencyCheckpoint(new PointF(225, 350), ec3); EmergencyRoute.Add(ec6); EmergencyRoute.Add(ec5); EmergencyRoute.Add(ec4); EmergencyRoute.Add(ec3); EmergencyRoute.Add(ec2); EmergencyRoute.Add(ec1); Rooms.ForEach(room => { Doors.AddRange(room.Doors); Walls.AddRange(room.Walls); }); }
void OnMouseDrag() { var camera = Camera.allCameras[0]; Vector3 cursorPoint = new Vector3( Input.mousePosition.x, Input.mousePosition.y, mScreenPoint.z); Vector3 worldpos = camera.ScreenToWorldPoint(cursorPoint); Vector3 restricted = new Vector3( worldpos.x, transform.position.y, worldpos.z ); Vector3 cursorPosition = restricted + mOffset; cursorPosition.x = SnapToGrid(cursorPosition.x, kGridSize); cursorPosition.z = SnapToGrid(cursorPosition.z, kGridSize); transform.position = cursorPosition; var ray = camera.ScreenPointToRay(Input.mousePosition); var wall = Walls.GetWall(ray.origin, ray.direction); SnapToWall(wall); }
public Core(Color color, GameObject positionCore) { this.color = color; this.PositionCore = positionCore; lvl = 1; name = "База"; peopleLimit = 1000; building.Add(this); this.eventAddArmy += AddLimitArmy; this.eventAddPeople += AddLimitPeople; workShop = new WorkShop(); building.Add(workShop); storage = new Storage(); storage.eventAddPeople += AddLimitPeople; building.Add(storage); walls = new Walls(); building.Add(walls); barrack = new Barrack(); barrack.eventAddArmy += AddLimitArmy; building.Add(barrack); portal = new Portal(); building.Add(portal); resources = new GameResources(200, 300, 500, 0); UpPriceImprovement(); }
public void Initialize() { Walls walls = new Walls(); wallsAdapter = new WallsAdapter(walls); gridWalls = wallsAdapter.GetGrid(); }
/// <summary> /// Получить из формы пользовательские параметры для фигуры /// </summary> /// <returns>Пользовательские параметры для фигуры</returns> private Figure GetFigure() { Walls wallsX = null; if (_textBoxHeightWallsX.Enabled) { wallsX = new Walls { Height = int.Parse(_textBoxHeightWallsX.Text), Points = _wallsX.Select(tb => int.Parse(tb.Text)).ToList() }; } Walls wallsY = null; if (_textBoxHeightWallsY.Enabled) { wallsY = new Walls { Height = int.Parse(_textBoxHeightWallsY.Text), Points = _wallsY.Select(tb => int.Parse(tb.Text)).ToList() }; } return(new Figure { X = int.Parse(_textBoxBaseX.Text), Y = int.Parse(_textBoxBaseY.Text), Z = int.Parse(_textBoxBaseZ.Text), WallsX = wallsX, WallsY = wallsY }); }
public void BuildWorld(LevelData data) { CurrentLevelData = data; foreach (var levelObject in data.LevelObjects) { var levelPos = TilesToPixels(levelObject.Key); switch (levelObject.Value.Type) { case TileType.Solid: Walls.Add(new StaticTile(levelPos, levelObject.Value.Key)); break; case TileType.PowerUp: Powerups.Add(new Powerup(levelPos)); break; case TileType.Spawner: spawnPointPositions.Add(levelPos); break; default: throw new ArgumentOutOfRangeException("Tile type not supported!"); } } foreach (var parallaxLayer in data.Parallax) { bgLayers.Add(new ParallaxLayer(parallaxLayer.Speed, parallaxLayer.SourceFile)); } game.renderer.LevelArea = TilesToPixels(data.TilesArea); }
public void Update(GameTime gameTime, Game1 gameRef, Walls walls) { if (InputHandler.KeyDown(Keys.Right)) { this[activePaddle].position.X += paddleSpeed; if (this[activePaddle].position.X > (gameRef.ScreenRectangle.Width - walls.width - this[activePaddle].paddleRect.Width)) { this[activePaddle].position.X = (gameRef.ScreenRectangle.Width - walls.width - this[activePaddle].paddleRect.Width); } } // move paddle if (InputHandler.KeyDown(Keys.Left)) { this[activePaddle].position.X -= paddleSpeed; if (this[activePaddle].position.X < walls.width) { this[activePaddle].position.X = walls.width; } } if (InputHandler.KeyReleased(Keys.A) && activePaddle <= 15) { activePaddle++; this[activePaddle].paddleRect.X = (gameRef.ScreenRectangle.Width / 2) - 32; } if (InputHandler.KeyReleased(Keys.Q) && activePaddle >= 1) { activePaddle--; this[activePaddle].paddleRect.X = (gameRef.ScreenRectangle.Width / 2) - 32; } this[activePaddle].Update(gameTime); }
void Start() { wallButtons.AddRange(gameObject.GetComponentsInChildren<WallButton>()); arrowButtonContainer = gameObject.GetComponentInChildren<ArrowButtonContainer>(); walls = gameObject.GetComponentInChildren<Walls>(); //lastWall = walls.PuzzleWalls.Last<DimensionWall>().GetComponent<DimensionWall>().CameraSpace; wallButtonsTelegram = new Telegram(wallButtons.Cast<ButtonBase>().ToList()); arrowButtonContainerTelegram = new Telegram(arrowButtonContainer); }
public void Awake() { empty_ = new RLTile(registry_, defaultFloorColor_, ' '); walls_ = new Walls( registry_, defaultWallColor_); floors_ = new RLTile[] { new RLTile( registry_, defaultFloorColor_, '\'', false ), new RLTile( registry_, defaultFloorColor_, ',', false ), new RLTile( registry_, defaultFloorColor_, '.', false ), new RLTile( registry_, defaultFloorColor_, '`', false ), new RLTile( registry_, defaultFloorColor_, '´', false ), new RLTile( registry_, defaultFloorColor_, '·', false ), }; }
public World() { instance = this; isGameOver = false; root = FPWorld.Create(64.0f); AddChild(backParticles = new FParticleSystem(150)); AddChild(chainHolder = new FContainer()); AddChild(beastShadowHolder = new FContainer()); AddChild(beastHolder = new FContainer()); AddChild(effectHolder = new FContainer()); AddChild(glowParticles = new FParticleSystem(150)); glowParticles.shader = FShader.Additive; AddChild(orbHolder = new FContainer()); uiStage = new FStage("UIStage"); Futile.AddStage(uiStage); uiStage.scale = Futile.stage.scale; uiStage.AddChild(uiHolder = new FContainer()); teams = GameManager.instance.activeTeams; InitBeasts(); InitOrbs(); InitUI(); spawnRateMultiplier = 1.0f; walls = new Walls(this); ListenForUpdate(HandleUpdate); Input.ResetInputAxes(); }
public void SetEdge(Direction direction, Walls edge) { edges[(int)direction] = edge; initializedEdgeCount += 1; }
public static Walls CreateRandomWalls(Device dx_device, int cnt, float minx, float maxx, float miny, float maxy) { Walls ret = new Walls(); Random rand = new Random(); Vector2[] boundary = new Vector2[4] { new Vector2(minx,miny), new Vector2(minx,maxy), new Vector2(maxx,miny), new Vector2(maxx,maxy), }; for (int i = 0; i < cnt; i++) { Vector2 p1, p2; p1.X = (float)rand.NextDouble() * (maxx - minx) + minx; p1.Y = (float)rand.NextDouble() * (maxy - miny) + miny; p2.X = (float)rand.NextDouble() * (maxx - minx) + minx; p2.Y = (float)rand.NextDouble() * (maxy - miny) + miny; ret.AddWall(dx_device, p1, p2, boundary); } return ret; }
private void btAutoSize_Click(object sender, EventArgs e) { if ((new Walls(dsWall)).Count == 0) return; CanvasView View = CurrentView(); Walls Walls = new Walls(dsWall); RectangleF RectangleF = new RectangleF (View.TranslateF(Walls.FirstWall.StartPoint.Pointer), new SizeF(0,0)); foreach (Wall Wall in Walls) foreach (WallPartSection WallPart in Wall) { RectangleF = BorderWall(RectangleF, View.TranslateF(WallPart.StartPoint.Pointer)); RectangleF = BorderWall(RectangleF, View.TranslateF(WallPart.FinishPoint.Pointer)); if (WallPart is WallArc) RectangleF = BorderWall(RectangleF,View.TranslateF((WallPart as WallArc).Middle)); } double cx = 0.15; double cy = 0.15; double kx = 0; if (RectangleF.Right - RectangleF.Left > 0.1) kx = (RectangleF.Right - RectangleF.Left) / (pnWall.Width * (1 - cx)); double ky = 0; if (RectangleF.Bottom - RectangleF.Top > 0.1) ky = (RectangleF.Bottom - RectangleF.Top) / (pnWall.Height * (1 - cy)); edZoom.Value = Convert.ToDecimal(Math.Min( Convert.ToDouble(edZoom.Value) / Math.Max(kx, ky), Convert.ToDouble(edZoom.Maximum))); View = CurrentView(); RectangleF = new RectangleF (View.TranslateF(Walls.FirstWall.StartPoint.Pointer), new SizeF(0,0)); foreach (Wall Wall in Walls) foreach (WallPartSection WallPart in Wall) { RectangleF = BorderWall(RectangleF, View.TranslateF(WallPart.StartPoint.Pointer)); RectangleF = BorderWall(RectangleF, View.TranslateF(WallPart.FinishPoint.Pointer)); if (WallPart is WallArc) RectangleF = BorderWall(RectangleF, View.TranslateF((WallPart as WallArc).Middle)); } edStartX.Value = Convert.ToDecimal( Convert.ToDouble(edStartX.Value) - (RectangleF.Left + RectangleF.Right) / 2 + pnWall.Width / 2); edStartY.Value = Convert.ToDecimal( Convert.ToDouble(edStartY.Value) - (RectangleF.Bottom + RectangleF.Top) / 2 + pnWall.Height / 2); pnWall.Invalidate(); }