protected override void OnActivate() { this.Ensage.Inventory.Attach(this); this.Owner = (Hero)this.Ensage.Context.Owner; this.Menu = new VaperMenu(this.Owner.HeroId); this.OrbwalkingMode = this.GetOrbwalkingMode(); this.Ensage.Orbwalker.RegisterMode(this.OrbwalkingMode); this.KillstealHandler = UpdateManager.Run(this.OnKillsteal, true, this.Menu.General.Killsteal); UpdateManager.Subscribe(this.OnUpdateParticles); this.Menu.General.DrawTargetLine.PropertyChanged += this.DrawTargetLinePropertyChanged; this.Menu.General.Killsteal.PropertyChanged += this.KillstealPropertyChanged; this.Ensage.Inventory.CollectionChanged += this.InventoryChanged; // Intro this.Ensage.Renderer.Draw += this.IntroDraw; UpdateManager.Run( async token => { var particleCount = 4; var rnd = new Random(); var stopwatch = new Stopwatch(); stopwatch.Start(); while (stopwatch.ElapsedMilliseconds < (10 * 1000)) { for (var i = 0; i < particleCount; ++i) { this.Ensage.Particle.AddOrUpdate( this.Owner, $"vaper_smoke_{i}", "particles/world_environmental_fx/rune_ambient_01_smoke.vpcf", ParticleAttachment.AbsOrigin, false, 0, this.Owner.Position + new Vector3(rnd.NextFloat(-500, 500), rnd.NextFloat(-500, 500), 0)); } await Task.Delay(125, token); } stopwatch.Stop(); Log.Debug($"deleting vape particles"); this.Ensage.Renderer.Draw -= this.IntroDraw; for (var i = 0; i < particleCount; ++i) { this.Ensage.Particle.Remove($"vaper_smoke_{i}"); } }, false); }
protected override void OnActivate() { this.Owner = (Hero)this.Ensage.Context.Owner; this.Menu = new VaperMenu(this.Owner.HeroId); this.orbwalkingMode = this.GetOrbwalkingMode(); this.Ensage.Orbwalker.RegisterMode(this.orbwalkingMode); this.KillstealHandler = UpdateManager.Run(this.OnKillsteal, true, this.Menu.General.Killsteal); UpdateManager.Subscribe(this.OnUpdateParticles); this.Menu.General.DrawTargetLine.PropertyChanged += this.DrawTargetLinePropertyChanged; this.Menu.General.Killsteal.PropertyChanged += this.KillstealPropertyChanged; this.Ensage.Inventory.CollectionChanged += this.InventoryChanged; }