//Lane Management public int CreateLane(int laneNumber) { var lane = new Lane { Id = Lanes.Count + 1, LaneNumber = laneNumber }; Lanes.Add(lane); return(lane.Id); }
public override void SetPosition(int index, Vector3 position) { base.SetPosition(index, position); Lanes.Clear(); for (int i = 1; i < Count; i++) { Lanes.Add(GetLane((Points[i - 1] + Points[i]) / 2)); } }
public GameSimulator(GameHandler handler, int tickrate) { _simulationThread = new Thread(() => Simulation()) { IsBackground = true }; _tickDuration = 1000 / tickrate; timeSinceLastTick = DateTime.Now; GameHandler = handler; Lanes.Add(new LaneController(GameHandler.Players[0], this)); Lanes.Add(new LaneController(GameHandler.Players[1], this)); Start(); }
/// <summary> /// Updates the lane list. /// </summary> public void UpdateLanes() { SqlCommand cmd = new SqlCommand("SELECT LaneID FROM Lane", connection); using (SqlDataReader reader = cmd.ExecuteReader()) { Lanes.Clear(); foreach (var i in reader) { Lanes.Add(reader.GetInt32(0)); } } }
public ChampionToFront(Champion c) { Name = c.Name; for (int i = 0; i < c.Lanes.Count; i++) { Lanes.Add(c.Lanes[i]); } Weight = c.Weight; Assistant = c.Assistant; Counter = c.Counter; EnemyAfraid = c.EnemyAfraid; WinRate = c.WinRate; BanRate = c.BanRate; }
public PoolViewModel(DocumentViewModel documentViewModel, PoolElement poolElement) : this(documentViewModel) { _poolElement = poolElement; BaseElement = _poolElement; int count = 0; foreach (LaneElement lane in poolElement.Lanes) { LaneViewModel laneViewModel = new LaneViewModel(count, this, lane); if (count == poolElement.Lanes.Count - 1) { PropertyChanged += laneViewModel.PoolPropertyChanged; } Lanes.Add(laneViewModel); count++; } MinHeight = CalculateMinHeight(); }
/// <summary> /// Adds a lane with a specified number of [obstacleType] obstacles to it and /// then readjusts the Y spacing of each lane. /// Precondition: defaultSpeed > 0 /// numberOfObstacles > 0 /// Post-condition: this.lanes.Count += 1 /// lane.obstacles.Count += numberOfObstacles /// @each lane yLocation readjusts accordingly /// </summary> /// <param name="laneSettings">The lane settings.</param> /// <exception cref="ArgumentOutOfRangeException"> /// </exception> public void AddLaneOfObstacles(IList <object> laneSettings) { var direction = (Direction)laneSettings[0]; var defaultSpeed = (double)laneSettings[1]; var obstacleType = (ObstacleType)laneSettings[2]; var maxNumberObstacles = (int)laneSettings[3]; if (maxNumberObstacles <= 0) { throw new ArgumentOutOfRangeException(); } if (defaultSpeed <= 0) { throw new ArgumentOutOfRangeException(); } var lane = new WaterLane(defaultSpeed, direction); lane.AddObstacles(obstacleType, maxNumberObstacles); Lanes.Add(lane); this.UpdateYLocationOfLanes(); }
private void RecalculateLanes() { if (Application.Current.MainWindow.Dispatcher.CheckAccess()) { if (_recalculatingLanes) { return; } _recalculatingLanes = true; var currentlyDragging = Application.Current.MainWindow.FindVisualChildren <TimeslotControl>().Where(x => x.HoldingStart || x.HoldingEnd).Select(x => x.Model); foreach (var lane in Lanes.ToList()) { var overlappers = lane.Items.Where(x => x.OverlapsAny(lane.Items)).Except(currentlyDragging).ToList(); while (overlappers.Count > 0) { lane.Items.Remove(overlappers.First()); var newLane = new TimelineLaneModel() { LaneNumber = Lanes.Count + 1 }; newLane.Items.Add(overlappers.First()); Lanes.Add(newLane); overlappers = lane.Items.Where(x => x.OverlapsAny(lane.Items)).ToList(); } } foreach (var lane in Lanes.OrderByDescending(x => x.LaneNumber).ToList()) { foreach (var item in lane.Items.ToList()) { foreach (var lane2 in Lanes.Where(x => x.LaneNumber < lane.LaneNumber).ToList()) { if (!item.OverlapsAny(lane2.Items)) { if (currentlyDragging.Contains(item)) { foreach (var item2 in lane2.Items.ToList()) { lane.Items.Add(item2); lane2.Items.Remove(item2); } } else { lane2.Items.Add(item); lane.Items.Remove(item); } } } } } foreach (var lane in Lanes.ToList()) { if (lane.Items.Count == 0) { Lanes.Remove(lane); } } foreach (var lane in Lanes) { lane.LaneNumber = Lanes.IndexOf(lane); } RaisePropertyChanged("Lanes"); _recalculatingLanes = false; } else { Application.Current.MainWindow.Dispatcher.Invoke(RecalculateLanes); } }
public LanePaths(Team myTeam) { var topPath = new List <Vector3>(); var midPath = new List <Vector3>(); var botPath = new List <Vector3>(); if (myTeam == Team.Radiant) { //dire paths topPath.Add(new Vector3(3154, 5811, 384)); topPath.Add(new Vector3(2903, 5818, 299)); topPath.Add(new Vector3(-248, 5852, 384)); topPath.Add(new Vector3(-1585, 5979, 384)); topPath.Add(new Vector3(-3253, 5981, 384)); topPath.Add(new Vector3(-3587, 5954, 384)); topPath.Add(new Vector3(-3954, 5860, 384)); topPath.Add(new Vector3(-4988, 5618, 384)); topPath.Add(new Vector3(-5714, 5514, 384)); topPath.Add(new Vector3(-6051, 5092, 384)); topPath.Add(new Vector3(-6299, 4171, 384)); topPath.Add(new Vector3(-6342, 3806, 384)); topPath.Add(new Vector3(-6419, 2888, 384)); topPath.Add(new Vector3(-6434, -2797, 256)); midPath.Add(new Vector3(4101, 3652, 384)); midPath.Add(new Vector3(3549, 3041, 256)); midPath.Add(new Vector3(2639, 2061, 256)); midPath.Add(new Vector3(2091, 1605, 256)); midPath.Add(new Vector3(1091, 845, 256)); midPath.Add(new Vector3(-163, -62, 256)); midPath.Add(new Vector3(-789, -579, 178)); midPath.Add(new Vector3(-1327, -1017, 256)); midPath.Add(new Vector3(-2211, -1799, 256)); midPath.Add(new Vector3(-2988, -2522, 256)); midPath.Add(new Vector3(-4103, -3532, 256)); botPath.Add(new Vector3(6239, 3717, 384)); botPath.Add(new Vector3(6166, 3097, 384)); botPath.Add(new Vector3(6407, 635, 384)); botPath.Add(new Vector3(6422, -816, 384)); botPath.Add(new Vector3(6477, -2134, 384)); botPath.Add(new Vector3(5995, -3054, 384)); botPath.Add(new Vector3(6071, -3601, 384)); botPath.Add(new Vector3(6127, -4822, 384)); botPath.Add(new Vector3(5460, -5893, 384)); botPath.Add(new Vector3(5070, -5915, 384)); botPath.Add(new Vector3(4412, -6048, 384)); botPath.Add(new Vector3(3388, -6125, 384)); botPath.Add(new Vector3(2641, -6135, 384)); botPath.Add(new Vector3(1320, -6374, 384)); botPath.Add(new Vector3(-174, -6369, 384)); botPath.Add(new Vector3(-1201, -6308, 384)); botPath.Add(new Vector3(-3036, -6072, 257)); } else { //radiant paths topPath.Add(new Vector3(-6604, -3979, 384)); topPath.Add(new Vector3(-6613, -3679, 384)); topPath.Add(new Vector3(-6775, -3420, 384)); topPath.Add(new Vector3(-6743, -3042, 369)); topPath.Add(new Vector3(-6682, -2124, 256)); topPath.Add(new Vector3(-6640, -1758, 384)); topPath.Add(new Vector3(-6411, -226, 384)); topPath.Add(new Vector3(-6370, 2523, 384)); topPath.Add(new Vector3(-6198, 3997, 384)); topPath.Add(new Vector3(-6015, 4932, 384)); topPath.Add(new Vector3(-5888, 5204, 384)); topPath.Add(new Vector3(-5389, 5548, 384)); topPath.Add(new Vector3(-4757, 5740, 384)); topPath.Add(new Vector3(-4066, 5873, 384)); topPath.Add(new Vector3(-3068, 6009, 384)); topPath.Add(new Vector3(-2139, 6080, 384)); topPath.Add(new Vector3(-1327, 6052, 384)); topPath.Add(new Vector3(-82, 6011, 384)); topPath.Add(new Vector3(1682, 5993, 311)); topPath.Add(new Vector3(2404, 6051, 256)); midPath.Add(new Vector3(-5000, -4458, 384)); midPath.Add(new Vector3(-4775, -4020, 384)); midPath.Add(new Vector3(-4242, -3594, 256)); midPath.Add(new Vector3(-3294, -2941, 256)); midPath.Add(new Vector3(-2771, -2454, 256)); midPath.Add(new Vector3(-2219, -1873, 256)); midPath.Add(new Vector3(-1193, -1006, 256)); midPath.Add(new Vector3(-573, -449, 128)); midPath.Add(new Vector3(-46, -49, 256)); midPath.Add(new Vector3(679, 461, 256)); midPath.Add(new Vector3(979, 692, 256)); midPath.Add(new Vector3(2167, 1703, 256)); midPath.Add(new Vector3(2919, 2467, 256)); midPath.Add(new Vector3(3785, 3132, 256)); botPath.Add(new Vector3(-3671, -6077, 384)); botPath.Add(new Vector3(-3138, -6168, 256)); botPath.Add(new Vector3(-2126, -6234, 256)); botPath.Add(new Vector3(-1064, -6383, 384)); botPath.Add(new Vector3(196, -6602, 384)); botPath.Add(new Vector3(1771, -6374, 384)); botPath.Add(new Vector3(3740, -6281, 384)); botPath.Add(new Vector3(5328, -5813, 384)); botPath.Add(new Vector3(5766, -5602, 384)); botPath.Add(new Vector3(6265, -4992, 384)); botPath.Add(new Vector3(6112, -3603, 384)); botPath.Add(new Vector3(6103, 1724, 256)); botPath.Add(new Vector3(6133, 2167, 256)); } Lanes.Add(LanePosition.Middle, midPath.ToArray()); Lanes.Add(myTeam == Team.Radiant ? LanePosition.Hard : LanePosition.Easy, botPath.ToArray()); Lanes.Add(myTeam == Team.Radiant ? LanePosition.Easy : LanePosition.Hard, topPath.ToArray()); }
// Método para añadir una Lane al atributo Lanes public void addLane(Lane l) { Lanes.Add(l); }
public void addLane(Lane lane) { Lanes.Add(lane); }
public LanePaths(Team myTeam) { var topPath = new List <Vector3>(); var midPath = new List <Vector3>(); var botPath = new List <Vector3>(); if (myTeam == Team.Radiant) { //dire paths topPath.Add(new Vector3(3154, 5811, 384)); topPath.Add(new Vector3(-480, 5793, 384)); topPath.Add(new Vector3(-1617, 5804, 384)); topPath.Add(new Vector3(-3599, 5793, 384)); topPath.Add(new Vector3(-4981, 5590, 384)); topPath.Add(new Vector3(-5488, 5404, 384)); topPath.Add(new Vector3(-5813, 5058, 384)); topPath.Add(new Vector3(-6111, 4176, 384)); topPath.Add(new Vector3(-6112, 2898, 384)); topPath.Add(new Vector3(-6157, 2380, 384)); topPath.Add(new Vector3(-6161, 2001, 384)); topPath.Add(new Vector3(-6192, 1362, 384)); topPath.Add(new Vector3(-6189, 994, 384)); topPath.Add(new Vector3(-6210, 334, 384)); topPath.Add(new Vector3(-6229, -22, 384)); topPath.Add(new Vector3(-6272, -1202, 384)); topPath.Add(new Vector3(-6336, -2420, 256)); midPath.Add(new Vector3(4101, 3652, 384)); midPath.Add(new Vector3(3598, 3092, 256)); midPath.Add(new Vector3(2570, 2098, 256)); midPath.Add(new Vector3(2095, 1608, 256)); midPath.Add(new Vector3(1216, 904, 256)); midPath.Add(new Vector3(966, 746, 256)); midPath.Add(new Vector3(765, 671, 256)); midPath.Add(new Vector3(300, 353, 256)); midPath.Add(new Vector3(-242, -4, 254)); midPath.Add(new Vector3(-904, -510, 196)); midPath.Add(new Vector3(-1170, -764, 256)); midPath.Add(new Vector3(-1964, -1501, 256)); midPath.Add(new Vector3(-2208, -1747, 256)); midPath.Add(new Vector3(-3003, -2514, 256)); midPath.Add(new Vector3(-3260, -2779, 256)); midPath.Add(new Vector3(-3523, -3021, 256)); midPath.Add(new Vector3(-3963, -3453, 256)); botPath.Add(new Vector3(6239, 3717, 384)); botPath.Add(new Vector3(6153, 3043, 384)); botPath.Add(new Vector3(6198, 2493, 351)); botPath.Add(new Vector3(6219, 2147, 256)); botPath.Add(new Vector3(6248, 1813, 261)); botPath.Add(new Vector3(6408, 632, 384)); botPath.Add(new Vector3(6422, -786, 384)); botPath.Add(new Vector3(6478, -2137, 384)); botPath.Add(new Vector3(6170, -2841, 384)); botPath.Add(new Vector3(6193, -3544, 384)); botPath.Add(new Vector3(6150, -4820, 384)); botPath.Add(new Vector3(5713, -5516, 384)); botPath.Add(new Vector3(5297, -5749, 384)); botPath.Add(new Vector3(4962, -5873, 384)); botPath.Add(new Vector3(4616, -5962, 384)); botPath.Add(new Vector3(3895, -6111, 384)); botPath.Add(new Vector3(3398, -6154, 384)); botPath.Add(new Vector3(2694, -6163, 384)); botPath.Add(new Vector3(1336, -6291, 384)); botPath.Add(new Vector3(989, -6281, 384)); botPath.Add(new Vector3(-1912, -6246, 256)); botPath.Add(new Vector3(-2939, -6243, 256)); } else { //radiant paths topPath.Add(new Vector3(-6641, -4072, 384)); topPath.Add(new Vector3(-6664, -3573, 384)); topPath.Add(new Vector3(-6771, -3388, 384)); topPath.Add(new Vector3(-6725, -2805, 256)); topPath.Add(new Vector3(-6682, -2124, 256)); topPath.Add(new Vector3(-6642, -1780, 384)); topPath.Add(new Vector3(-6589, -1448, 384)); topPath.Add(new Vector3(-6410, -227, 384)); topPath.Add(new Vector3(-6402, 108, 384)); topPath.Add(new Vector3(-6366, 4061, 384)); topPath.Add(new Vector3(-6204, 4966, 384)); topPath.Add(new Vector3(-5910, 5405, 384)); topPath.Add(new Vector3(-5410, 5582, 384)); topPath.Add(new Vector3(-4765, 5666, 384)); topPath.Add(new Vector3(-3111, 5766, 384)); topPath.Add(new Vector3(-2192, 5809, 384)); topPath.Add(new Vector3(948, 5794, 384)); topPath.Add(new Vector3(1620, 5809, 342)); topPath.Add(new Vector3(2301, 5768, 264)); midPath.Add(new Vector3(-5000, -4458, 384)); midPath.Add(new Vector3(-4820, -4157, 384)); midPath.Add(new Vector3(-4255, -3605, 256)); midPath.Add(new Vector3(-3331, -2905, 256)); midPath.Add(new Vector3(-1289, -904, 256)); midPath.Add(new Vector3(-660, -373, 129)); midPath.Add(new Vector3(-137, -5, 256)); midPath.Add(new Vector3(669, 479, 256)); midPath.Add(new Vector3(946, 688, 256)); midPath.Add(new Vector3(1216, 906, 256)); midPath.Add(new Vector3(2169, 1708, 256)); midPath.Add(new Vector3(2419, 1948, 256)); midPath.Add(new Vector3(2921, 2456, 256)); midPath.Add(new Vector3(3460, 2937, 264)); botPath.Add(new Vector3(-3671, -6077, 384)); botPath.Add(new Vector3(-3145, -6175, 256)); botPath.Add(new Vector3(-2684, -6198, 256)); botPath.Add(new Vector3(-2123, -6239, 256)); botPath.Add(new Vector3(-1759, -6297, 256)); botPath.Add(new Vector3(-1425, -6335, 311)); botPath.Add(new Vector3(-1070, -6368, 384)); botPath.Add(new Vector3(207, -6597, 384)); botPath.Add(new Vector3(581, -6531, 384)); botPath.Add(new Vector3(1761, -6373, 384)); botPath.Add(new Vector3(3014, -6119, 384)); botPath.Add(new Vector3(4323, -5940, 384)); botPath.Add(new Vector3(5315, -5771, 384)); botPath.Add(new Vector3(5674, -5550, 384)); botPath.Add(new Vector3(6132, -4854, 384)); botPath.Add(new Vector3(6240, -3820, 384)); botPath.Add(new Vector3(6240, 944, 384)); botPath.Add(new Vector3(6333, 1787, 264)); } Lanes.Add(LanePosition.Middle, midPath.ToArray()); Lanes.Add(myTeam == Team.Radiant ? LanePosition.Hard : LanePosition.Easy, botPath.ToArray()); Lanes.Add(myTeam == Team.Radiant ? LanePosition.Easy : LanePosition.Hard, topPath.ToArray()); }
public void Initialize() { p1 = new Player(this, 1); p2 = new Player(this, 2); this.UIElements.Add(p1); this.UIElements.Add(p2); this.PlayerList.Add(p1); this.PlayerList.Add(p2); for (int i = 0; i < 3; i++) { Lane lane = new Lane(i); Lanes.Add(lane); } DesignMode.Bounds = new Area() { World = new Rectangle() { X = Constants.ScreenBounds.Right - Constants.TileSize, Y = Constants.ScreenBounds.Bottom - Constants.TileSize, Width = Constants.TileSize, Height = Constants.TileSize } }; DesignMode.Text = "Design"; UIElements.Add(DesignMode); DesignMode.Click += DesignMode_Click; UnitPlacementPanel.Bounds = new Area() { World = new Rectangle() { X = Constants.ScreenBounds.Left, Y = Constants.ScreenBounds.Top, Width = Constants.TileSize * 12, Height = Constants.ScreenBounds.Height } }; UnitPlacementPanel.isVisible = false; UIElements.Add(UnitPlacementPanel); UnitPlacementPanel.Click += ControlPanel_Click; UnitSelectionPanel.Bounds = new Area() { Grid = new Rectangle() { X = 0, Y = 0, Width = 3, Height = 3 } }; UnitSelectionPanel.isVisible = false; this.UIElements.Add(UnitSelectionPanel); int oX = UnitSelectionPanel.Bounds.Grid.X; int oY = UnitSelectionPanel.Bounds.Grid.Y; int r = 0; foreach (var Building in PlayerList[0].BuildingTemplates) { UIElement btnBuilding = new UIElement(); btnBuilding.Bounds = new Area() { Grid = new Rectangle() { X = oX + (r % 3), Y = oY + (r / 3), Width = 1, Height = 1 } }; btnBuilding.Tag = Building; btnBuilding.Click += btnBuilding_Click; UnitSelectionPanel.UIElements.Add(btnBuilding); r++; } }
private void InitLane(KanbanState state) { Lanes.Add(new LaneViewModel(state)); LoadTasks(state); }