public override void _Ready() { var size = GetViewportRect().Size; var path = new SimplePath(); path.Points.Add(new Vector2(0, size.y / 2)); path.Points.Add(new Vector2(size.x / 8, size.y * 3 / 4)); path.Points.Add(new Vector2(size.x / 2, (size.y / 2) - 50)); path.Points.Add(new Vector2(size.x, size.y / 2)); AddChild(path); var vehicle1 = new SimpleVehicle() { Position = new Vector2(100, 100), TargetPath = path }; AddChild(vehicle1); var vehicle2 = new SimpleVehicle() { Position = new Vector2(100, size.y - 100), TargetPath = path }; AddChild(vehicle2); }
public override void _Ready() { var size = GetViewportRect().Size; var path = new SimplePath(); path.Points.Add(new Vector2(0, size.y / 2)); path.Points.Add(new Vector2(size.x / 8, size.y * 3 / 4)); path.Points.Add(new Vector2(size.x / 2, (size.y / 2) - 50)); path.Points.Add(new Vector2(size.x, size.y / 2)); AddChild(path); const int boidsCount = 50; var spawner = new SimpleTouchSpawner() { SpawnFunction = (pos) => { var boid = new SimpleBoid() { VehicleGroupList = boids, Position = pos, TargetPath = path }; boids.Add(boid); return(boid); } }; AddChild(spawner); for (int i = 0; i < boidsCount; ++i) { spawner.SpawnBody(MathUtils.RandVector2(0, size.x, 0, size.y)); } }
private void cmDeleteFile_Click(object sender, EventArgs e) { if (dgvData.SelectedRows.Count < 1) { SimpleMessage.ShowInfo("Please select file."); return; } try { if (SimpleMessage.Confirm("Are you sure to delete selected file(s)?") == DialogResult.Yes) { string path = SimplePath.GetFullPath(treeView1.SelectedNode.FullPath); for (int i = 0; i < dgvData.SelectedRows.Count; i++) { string file = PathUtils.GetFileName(dgvData.SelectedRows[i], path); File.Delete(file); } TreeViewHandler.RefreshNode(treeView1.SelectedNode); } } catch (Exception ex) { SimpleMessage.ShowException(ex); } }
public CreepManager(ref SimplePath path) { this.path = path; creepSpawnIntervalReset = creepSpawnInterval; waveSpawnTimerReset = waveSpawnTimer; life = 1; }
public CreepManager(ref SimplePath path) { this.path = path; creepSpawnIntervalReset = creepSpawnInterval; waveSpawnTimerReset = waveSpawnTimer; life = 1; }
public void TestInit() { hotel = new Hotel(); hotelRooms = new List <Room>(); cleaner = new Cleaner(); simplePath = new SimplePath(); }
/// <summary> /// Gets the next room that needs to be cleaned /// </summary> /// <param name="gameTime"></param> /// <param name="simplePath"></param> /// <param name="RoomQueue"></param> public void GetRoom(GameTime gameTime, SimplePath simplePath, Queue <Room> RoomQueue) { if (!Evacuating) { if (RoomQueue.Count > 0) { if (Room != null && !Cleaning) { Room = RoomQueue.First(); RoomQueue.Dequeue(); Room.State = RoomState.Cleaning; Cleaning = true; Destination = Room.Position; Route = simplePath.GetRoute(Position, Destination); } } if (Position == VasteLocatie && Room.State == RoomState.Cleaning) { Room.State = RoomState.Dirty; } if (Room != null && Position == Destination && Cleaning == true) { Clean(Room, gameTime, simplePath); } } }
public void Update(double deltaTime, SimplePath path) { oldPosition = position; if (slowedTimer <= 0) { texPos += (float)(speed * deltaTime); color = originalColor; } else { texPos += (float)(speed * deltaTime) * slowedModifier; color = Color.CornflowerBlue; } slowedTimer -= deltaTime; position = path.GetPos(texPos); if (health <= 0) { UserInterface.gold += goldValue; isDead = true; } LookAt(position, oldPosition); base.Update(deltaTime); }
public frmStrongName(IHost mainForm, string[] rows, string sourceDir) { InitializeComponent(); _host = mainForm; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); if (!String.IsNullOrEmpty(Config.SNOutputDir)) { txtOutputDir.Text = Config.SNOutputDir; } else { txtOutputDir.Text = _sourceDir; } if (!String.IsNullOrEmpty(Config.StrongKeyFile)) { txtKeyFile.Text = Config.StrongKeyFile; } txtAdditionalOptions.Text = Config.SNAdditionalOptions; OptionChanged(); }
public void TestInit() { hotel = new Hotel(); hotelRooms = new List <Room>(); simplePath = new SimplePath(); person = new Customer(); person.Route = new Stack <Node>(); person2 = new Customer(); person2.Route = new Stack <Node>(); cleaner = new Cleaner(); persons = new List <IPerson>(); customers = new List <Customer>() { person, person2, }; cleaners = new List <Cleaner> { cleaner }; persons.Add(cleaner); persons.Add(person); persons.Add(person2); reception = new Reception(); lobby = new Lobby(); stairs = new Stairs(); eventChecker = new EventChecker(); }
public override void _Ready() { var size = GetViewportRect().Size; var path = new SimplePath(); path.Points.Add(new Vector2(size.x * 1 / 4, size.y * 1 / 4)); path.Points.Add(new Vector2(size.x * 3 / 4, size.y * 1 / 4)); path.Points.Add(new Vector2(size.x * 3 / 4, size.y * 3 / 4)); path.Points.Add(new Vector2((size.x * 1 / 4) - 20, size.y * 3 / 4)); path.Looping = true; AddChild(path); var spawner = new SimpleTouchSpawner() { SpawnFunction = (pos) => { var vehicle = new RandomVehicle() { VehicleGroupList = vehicles, Position = pos, TargetPath = path, SeparationEnabled = true }; vehicles.Add(vehicle); return(vehicle); } }; AddChild(spawner); for (int i = 0; i < vehicleCount; ++i) { spawner.SpawnBody(MathUtils.RandVector2(0, size.x, 0, size.y)); } }
/// <summary> /// after customer is done waiting he returns to his room. /// if he wants to enter the restaurant and it's full he also returns to his room. /// </summary> /// <param name="gameTime"></param> /// <param name="simplePath"></param> /// <param name="hotel"></param> public void ReturnToRoom(GameTime gameTime, SimplePath simplePath, Hotel hotel) { if (Room != null && Position != Room.Position && Position == Destination) { Restaurant restaurant = (Restaurant)hotel.Areas.Where(a => a.AreaType == "Restaurant").FirstOrDefault(); float tussenTijd = gameTime.ElapsedGameTime.Milliseconds; tussenTijd /= 1000; _passedTimeSinceUpdate += tussenTijd; if (_passedTimeSinceUpdate >= WaitingTime / HotelEventManager.HTE_Factor) { Destination = Room.Position; Route = simplePath.GetRoute(Position, Destination); if (Position == restaurant.Position) { restaurant.HuidigeBezetting--; } } if (Position == restaurant.Position && restaurant.Capacity < restaurant.HuidigeBezetting) { Destination = Room.Position; Route = simplePath.GetRoute(Position, Destination); restaurant.HuidigeBezetting--; } } }
public void Update(double deltaTime, SimplePath path) { oldPosition = position; if (slowedTimer <= 0) { texPos += (float)(speed * deltaTime); color = originalColor; } else { texPos += (float)(speed * deltaTime) * slowedModifier; color = Color.CornflowerBlue; } slowedTimer -= deltaTime; position = path.GetPos(texPos); if (health <= 0) { UserInterface.gold += goldValue; isDead = true; } LookAt(position, oldPosition); base.Update(deltaTime); }
public void CheckCinemaTest() { Cinema cinema = new Cinema() { Position = new Vector2(3, 0) }; Vector2 wachtVector = new Vector2(2, 0); person.Position = new Vector2(1, 0); person.Destination = cinema.Position; Node a = new Node(person.Position); Node b = new Node(wachtVector); Node c = new Node(cinema.Position); c.Edges.Add(a, 1); a.Edges.Add(c, 1); b.Edges.Add(a, 1); a.Edges.Add(b, 1); cinema.Started = true; SimplePath simplePath = new SimplePath(); simplePath.Add(a); simplePath.Add(b); simplePath.Add(c); person.CheckCinema(simplePath, cinema); Assert.AreEqual(wachtVector, person.Destination); }
public void TestInit() { hotel = new Hotel(); hotelRooms = new List <Room>(); simplePath = new SimplePath(); person = new Customer(); person.Route = new Stack <Node>(); }
Vector3 PathFollowing(SimplePath path) { Vector3 predictedLocation = cachedTransform.position + velocity.normalized * predictionDistance;// maxSpeed; predictedLocationMarker.position = predictedLocation; float shortestSqrMagnitude = Mathf.Infinity; int startIndexOfClosestLine = -1; Vector3 closestNormalPoint = Vector3.zero; // Find the closest normal point by checking against all lines in path. for (int i = 0; i < path.points.Count - 1; i++) { Vector3 normalPoint = ComputeClampedNormalPoint(predictedLocation, path.points[i], path.points[i + 1]); float sqrMagnitudeAB = (path.points[i + 1] - path.points[i]).sqrMagnitude; // The normal cannot be between A & B if its distance to A or B exceeds the length of AB. if (sqrMagnitudeAB < (normalPoint - path.points[i]).sqrMagnitude) { normalPoint = path.points[i + 1]; } else if (sqrMagnitudeAB < (normalPoint - path.points[i + 1]).sqrMagnitude) { normalPoint = path.points[i]; } float sqrMagnitudeFromNormal = (predictedLocation - normalPoint).sqrMagnitude; if (sqrMagnitudeFromNormal < shortestSqrMagnitude) { shortestSqrMagnitude = sqrMagnitudeFromNormal; startIndexOfClosestLine = i; closestNormalPoint = normalPoint; } } // If no valid noraml could be found, redirect the boid to the start of the path. if (startIndexOfClosestLine == -1) { return(SteeringBehaviors.Seek(cachedTransform.position, velocity, maxSpeed, path.points[0])); } normalPointMarker.position = closestNormalPoint; Vector3 pathDirection = path.points[startIndexOfClosestLine + 1] - path.points[startIndexOfClosestLine]; Vector3 futurePathTarget = closestNormalPoint + pathDirection.normalized;// * predictionDistance; futurePathTargetMarker.position = futurePathTarget; if (shortestSqrMagnitude > path.radius * path.radius) { return(SteeringBehaviors.Seek(cachedTransform.position, velocity, maxSpeed, futurePathTarget)); } else // No steering required { return(Vector3.zero); } }
public Enemy(Texture2D texture, Game1 game, SimplePath path) : base(texture, Vector2.Zero,new Vector2(texture.Width / 2, texture.Height / 2)) { this.pos = path.GetPos(path.endT); this.texture = texture; this.game = game; this.path = path; currentpos = path.beginT; followPath = path.GetPos(currentpos + 0.1f) - path.GetPos(currentpos); }
public frmVerify(IHost mainForm, string[] rows, string sourceDir) { InitializeComponent(); _host = mainForm; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); txtAdditionalOptions.Text = Config.PEVerifyAdditionalOptions; }
public frmDe4dot(IHost host, string[] rows, string sourceDir) { InitializeComponent(); _host = host; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); InitForm(); }
private void InitForm(ClassEditParams p) { try { //this.SuspendLayout(); Host = p.Host; Rows = p.Rows; SourceDir = SimplePath.GetFullPath(p.SourceDir); ShowStaticOnly = p.ShowStaticOnly; ShowSelectButton = p.ShowSelectButton; tbSelect.Visible = ShowSelectButton; tbSave.Visible = !ShowSelectButton; //dgBody.Visible = false; //dgResource.Visible = false; //panelResource.Visible = false; dgBody.Dock = DockStyle.Fill; dgResource.Dock = DockStyle.Fill; panelResource.Dock = DockStyle.Fill; txtResource.Dock = DockStyle.Fill; //pbResource.Dock = DockStyle.Fill; pbResource.Left = 0; pbResource.Top = 0; lvResource.Dock = DockStyle.Fill; hbResource.Dock = DockStyle.Fill; rtbText.Font = Config.ClassEditorRichTextBoxFont; rtbILSpyText.Font = Config.ClassEditorRichTextBoxFont; LogHandler = new ClassEditLogHandler(this); BodyGridHandler = new ClassEditBodyGridHandler(this); VariableGridHandler = new ClassEditVariableGridHandler(this); ResourceHandler = new ClassEditResourceHandler(this); SearchHandler = new ClassEditSearchHandler(this); ReflectorHandler = new ClassEditReflectorHandler(this); ILSpyHandler = new ClassEditILSpyHandler(this); BookmarkHandler = new ClassEditBookmarkHandler(this); TreeViewHandler = new ClassEditTreeViewHandler(this); BinaryViewHandler = new ClassEditBinaryViewHandler(this); TextViewHandler = new ClassEditTextViewHandler(this); TreeViewHandler.ObjectType = p.ObjectType; } catch { throw; } finally { //this.ResumeLayout(); } }
public frmMethodSearcher(IHost host, string[] rows, string sourceDir) { InitializeComponent(); _host = host; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); cboSearchFor.Items.Add("// This item is obfuscated and can not be translated."); cboSearchFor.Items.Add("// This item appears to be generated and can not be translated."); cboSearchFor.Items.Add("using (enumerator ="); if (!String.IsNullOrEmpty(this.LastSearchFor)) { cboSearchFor.Text = this.LastSearchFor; } else { cboSearchFor.SelectedIndex = 0; } switch (this.LogTo) { case "Screen": rbToScreen.Checked = true; break; case "File": rbToFile.Checked = true; break; default: break; } _reflector = SimpleReflector.Default; //_reflector.FormatterType = typeof(TextFormatter); _reflector.FormatterTypeName = "SimpleAssemblyExplorer.LutzReflector.TextFormatter"; foreach (string l in _reflector.Languages) { int index = cboLanguage.Items.Add(l); if (l == "C#") { cboLanguage.SelectedIndex = index; } } //foreach (string op in SimpleReflector.OptimizationList) //{ // int index = cboOptimization.Items.Add(op); // if (op == "2.0") // { // cboOptimization.SelectedIndex = index; // } //} }
public void InitCRPath() { Path = new SimplePath(GameObj.transform.position, m_vecpathend); Path.Speed = Utility.Range(2.0f, 3.0f); //Vector3 PlayerPos = SceneRuntime.GetLauncherGoldIconPos(catchedData.ClientSeat); //Vector3 startControl = (((GameObj.transform.position + PlayerPos) * 0.5f) + GameObj.transform.position)*0.5f; //Vector3 endControl = (((GameObj.transform.position + PlayerPos) * 0.5f) + PlayerPos)*0.5f; //Path = new CRPath(GameObj.transform.position, startControl, PlayerPos, endControl); //Path.Speed = GetPathSpeed(); }
public frmRunMethod(IHost mainForm, string[] rows, string sourceDir) { InitializeComponent(); _host = mainForm; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); _parameters = new DataTable(); _parameters.Columns.Add("name", typeof(String)); _parameters.Columns.Add("type", typeof(String)); _parameters.Columns.Add("value", typeof(String)); }
/// <summary> /// finds an empty room for every customer and sends them to their room /// </summary> /// <param name="hotel"></param> /// <param name="simplePath"></param> public void HelpQueue(Hotel hotel, SimplePath simplePath) { if (_queue.Count > 0) { Customer helpMe = _queue.Dequeue(); helpMe.Room = GetFreeRoom(helpMe.Preferance, hotel); helpMe.Room.State = Room.RoomState.Booked; helpMe.Destination = helpMe.Room.Position; helpMe.Route = simplePath.GetRoute(helpMe.Position, helpMe.Destination); QueuePosition--; } }
public LevelManager(GraphicsDevice graphics) { this.graphics = graphics; path = new SimplePath(graphics); path.Clean(); ReadPathFromFile(); enemySpawnRate = 500; enemyWaveTimer = 500; amountOfEnemies = 2; waveCount = 0; limitCount = 8; }
/// <summary> /// Initialize the properties of the menuform /// </summary> /// <param name="hotel"></param> /// <param name="cleaners"></param> /// <param name="customers"></param> /// <param name="persons"></param> /// <param name="stairs"></param> /// <param name="simplePath"></param> public MenuForm(Hotel hotel, List <Cleaner> cleaners, List <Customer> customers, List <IPerson> persons, Stairs stairs, SimplePath simplePath) { Customers = customers; Cleaners = cleaners; Persons = persons; Hotel = hotel; Stairs = stairs; SimplePath = simplePath; InitializeComponent(); InitMenu(); MovieTime = 50; EatingSpeed = 10; CleanSpeed = 10; }
public void RefreshNode(TreeNode node, bool force) { if (node == null) { return; } if (_treeviewUpdating) { return; } try { treeView1.BeginUpdate(); _treeviewUpdating = true; if (force || node.Nodes.Count == 0) { AddDirectories(node); node.Expand(); } // Get files from disk, add to DataGridView control AddFiles(node.FullPath); SetPath(SimplePath.GetFullPathWithoutTrailingSeparator(node.FullPath), false); if (escPressed) { SetStatusText("Operation cancelled."); } else { SetStatusText(String.Format("{0} Folder{1}, {2} File{3}", node.Nodes.Count, (node.Nodes.Count > 1 ? "s" : ""), dgvData.Rows.Count, (dgvData.Rows.Count > 1 ? "s" : ""))); } CheckDropFile(null); } catch (Exception ex) { SetStatusText(ex.Message); } finally { treeView1.EndUpdate(); _treeviewUpdating = false; } }
/// <summary> /// customer checks if the cinema he wants to enter has started. /// if the cinema is already running a movie before he has entered he returns to his room. /// </summary> /// <param name="simplePath"></param> /// <param name="cinema"></param> public void CheckCinema(SimplePath simplePath, Cinema cinema) { if (cinema != null) { if (Destination == cinema.Position && Position != cinema.Position && cinema.Started) { Destination = new Vector2(cinema.Position.X - 1f, cinema.Position.Y); Route = simplePath.GetRoute(Position, Destination); } if (Destination.X == cinema.Position.X - 1f && Position != cinema.Position && cinema.Started) { WaitingTime = int.MaxValue; } } }
private void cmFolderDelete_Click(object sender, EventArgs e) { try { string path = SimplePath.GetFullPath(treeView1.SelectedNode.FullPath); if (SimpleMessage.Confirm(String.Format("Are you sure to delete selected folder:\n{0}?", path)) == DialogResult.Yes) { Directory.Delete(path, true); treeView1.SelectedNode.Remove(); } } catch (Exception ex) { SimpleMessage.ShowException(ex); } }
/// <summary> /// cleaner starts cleaning. /// after cleaning is finished the room is free and the cleaner goes back to the optimal position. /// </summary> /// <param name="room"></param> /// <param name="gameTime"></param> /// <param name="simplePath"></param> private void Clean(Room room, GameTime gameTime, SimplePath simplePath) { if (Cleaning && Room == null) { Cleaning = false; } float tussenTijd = gameTime.ElapsedGameTime.Milliseconds; tussenTijd /= 1000; passedTimeSinceUpdate += tussenTijd; if (passedTimeSinceUpdate >= CleaningSpeed / HotelEventManager.HTE_Factor) { room.State = Room.RoomState.Free; Cleaning = false; Destination = VasteLocatie; Route = simplePath.GetRoute(Position, Destination); } }
public frmDasm(IHost mainForm, string[] rows, string sourceDir) { InitializeComponent(); _host = mainForm; _rows = rows; _sourceDir = SimplePath.GetFullPath(sourceDir); if (!String.IsNullOrEmpty(Config.DasmOutputDir)) { txtOutputDir.Text = Config.DasmOutputDir; } else { txtOutputDir.Text = _sourceDir; } txtAdditionalOptions.Text = Config.DasmAdditionalOptions; }
public override void _Ready() { var size = GetViewportRect().Size; var path = new SimplePath(); path.Points.Add(new Vector2(0, size.y / 3)); path.Points.Add(new Vector2(size.x, 2 * size.y / 3)); AddChild(path); var vehicle = new SimpleVehicle() { TargetPath = path, Velocity = new Vector2(10, 0), Position = new Vector2(100, 100) }; AddChild(vehicle); }
public void TestInit() { RoomQueue = null; gameTime = null; room = new Room(); hotel = new Hotel(); hotelRooms = new List <Area>(); simplePath = new SimplePath(); person = new Customer(); person.ID = 1; person.Room = room; person.Position = new Vector2(6, 7); person.Route = new Stack <Node>(); person2 = new Customer(); person.Position = new Vector2(6, 9); person2.Route = new Stack <Node>(); cleaner = new Cleaner() { Position = new Vector2(34, 2), Room = room }; persons = new List <IPerson>(); customers = new List <Customer>() { person, person2, }; cleaners = new List <Cleaner> { cleaner }; persons.Add(cleaner); persons.Add(person); persons.Add(person2); reception = new Reception(); lobby = new Lobby() { Position = new Vector2(2, 2) }; elevator = new Elevator(); listener = new EventListener(); eventChecker = new EventChecker(); }
public Level(GraphicsDevice graphics) { path = new SimplePath(graphics); path.Clean(); path.AddPoint(new Vector2(225, -64)); path.AddPoint(new Vector2(190, 535)); path.AddPoint(new Vector2(240, 700)); path.AddPoint(new Vector2(350, 760)); path.AddPoint(new Vector2(555, 745)); path.AddPoint(new Vector2(635, 645)); path.AddPoint(new Vector2(620, 470)); path.AddPoint(new Vector2(605, 290)); path.AddPoint(new Vector2(655, 200)); path.AddPoint(new Vector2(780, 155)); path.AddPoint(new Vector2(935, 195)); path.AddPoint(new Vector2(990, 345)); path.AddPoint(new Vector2(960, 984)); creepManager = new CreepManager(ref path); towerManager = new TowerManager(ref creepManager, graphics); }
public void LoadContent(SpriteBatch spriteBatch) { mh = new MapHandler(game.GraphicsDevice); floor = game.Content.Load<Texture2D>(@"floortd"); turtleSprite = game.Content.Load<Texture2D>(@"Turtle"); penguinKing = game.Content.Load<Texture2D>(@"Penguin_King"); penguinMad = game.Content.Load<Texture2D>(@"Penguin_Mad"); penguinNormal = game.Content.Load<Texture2D>(@"Penguin_Normal"); shotsprite = game.Content.Load<Texture2D>(@"snowball"); test = game.Content.Load<Texture2D>(@"snowball"); List<Texture2D> textures = new List<Texture2D>(); textures.Add(game.Content.Load<Texture2D>("circle")); emitter = new Emitter(textures, new Vector2(400, 240)); enemy = new List<Enemy>(); tower = new List<Tower>(); shot = new List<Shot>(); mh.LoadContent(); path = mh.GetSimplePath(); UpdateRenderTarget(spriteBatch); }
public void LoadContent() { spline = new SimplePath(graphics); spline.Clean(); MapMaker(); }
private void Create_level() { //Creates lists enemies = new List<Enemy>(); menu_towers = new List<Tower>(); interactive_towers = new List<Tower>(); //Sets int and float values enemy_amount = 0; tower_placed_amount = 0; enemy_interval = 100; //Creates instances menu_tower1 = new Tower(sheet_tex, new Vector2(1080, 50), new Rectangle(0, 0, 45, 70)); menu_tower2 = new Tower(sheet_tex, new Vector2(1123, 50), new Rectangle(45, 0, 45, 70)); menu_tower3 = new Tower(sheet_tex, new Vector2(1167, 50), new Rectangle(90, 0, 45, 70)); path = new SimplePath(graphics); layer = new RenderTarget2D(graphics, 1220, 720); menu_towers.Add(menu_tower1); menu_towers.Add(menu_tower2); menu_towers.Add(menu_tower3); //Creates steamreader sr = new StreamReader("Level1.txt"); path.Clean(); //Reads and creates spline points from text file while (!sr.EndOfStream) { string s = sr.ReadLine(); int x = int.Parse(s.Split(',')[0]); int y = int.Parse(s.Split(',')[1]); path.AddPoint(new Vector2(x, y)); } Draw_rendertarget(); }
public void get_path(SimplePath path) { this.path = path; }