Exemplo n.º 1
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_invoker_sun_strike")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle(
                    "particles/econ/items/invoker/invoker_apex/invoker_sun_strike_team_immortal1.vpcf",
                    sender.Position);
                effect.Release();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 2
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_slark_dark_pact")
                {
                    return;
                }

                this.unit = EntityManager9.GetUnit(sender.Handle);
                if (this.unit == null)
                {
                    return;
                }

                this.effect = ParticleManager.CreateParticle(
                    "particles/units/heroes/hero_slark/slark_dark_pact_start.vpcf",
                    ParticleAttachment.AbsOriginFollow,
                    sender);

                ModifierManager.ModifierRemoved += this.OnModifierRemoved;
                this.handler.IsEnabled           = true;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 3
0
        private void UnitMonitorOnUnitHealthChange(Unit9 unit, float health)
        {
            try
            {
                if (!unit.IsTower)
                {
                    return;
                }

                if (health / unit.MaximumHealth > 0.1)
                {
                    if (!this.towers.TryGetValue(unit, out var effect))
                    {
                        return;
                    }

                    effect.Dispose();
                    this.towers.Remove(unit);
                }
                else
                {
                    if (this.towers.TryGetValue(unit, out var effect) && effect.IsValid)
                    {
                        return;
                    }

                    this.towers[unit] = ParticleManager.CreateParticle("particles/msg_fx/msg_deniable.vpcf", unit.Position.IncreaseZ(125));
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 4
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team != this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_sniper_assassinate")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle(
                    "particles/units/heroes/hero_sniper/sniper_crosshair.vpcf",
                    ParticleAttachment.OverheadFollow,
                    sender);

                this.effects.Add(sender.Handle, effect);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 5
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifer = e.Modifier;
                var sender  = modifer.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifer.Name != "modifier_leshrac_split_earth_thinker")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle("particles/units/heroes/hero_leshrac/leshrac_split_projected.vpcf", sender.Position);
                effect.SetControlPoint(1, this.radius);

                effect.Release();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 6
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_kunkka_torrent_thinker")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle(
                    "particles/econ/items/kunkka/divine_anchor/hero_kunkka_dafx_skills/kunkka_spell_torrent_bubbles_fxset.vpcf",
                    sender.Position);
                effect.Release();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 7
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_lina_light_strike_array")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle("particles/econ/items/lina/lina_ti7/light_strike_array_pre_ti7.vpcf", sender.Position);
                effect.SetControlPoint(1, this.radius);

                effect.Release();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 8
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team != this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_tusk_snowball_target")
                {
                    return;
                }

                this.effect = ParticleManager.CreateParticle(
                    "particles/units/heroes/hero_tusk/tusk_snowball_target.vpcf",
                    ParticleAttachment.OverheadFollow,
                    sender);

                ModifierManager.ModifierRemoved += this.OnModifierRemoved;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 9
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team != this.ownerTeam)
                {
                    return;
                }

                if (!(sender is Hero))
                {
                    return;
                }

                if (modifier.Name != "modifier_truesight" && modifier.Name != "modifier_item_dustofappearance")
                {
                    return;
                }

                if (this.effects.ContainsKey(sender.Handle))
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle("particles/items2_fx/ward_true_sight.vpcf", ParticleAttachment.CenterFollow, sender);
                this.effects.Add(sender.Handle, effect);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 10
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team != this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_bounty_hunter_track")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle(
                    "particles/econ/items/bounty_hunter/bounty_hunter_hunters_hoard/bounty_hunter_hoard_shield.vpcf",
                    ParticleAttachment.OverheadFollow,
                    sender);

                this.effects.Add(sender.Handle, effect);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 11
0
        private void OnUpdate()
        {
            try
            {
                var hero = this.owner.Hero;

                foreach (var pair in this.units.ToList())
                {
                    var unit   = pair.Key;
                    var effect = pair.Value;

                    if (!unit.IsValid || !unit.IsAlive)
                    {
                        if (effect?.IsValid == true)
                        {
                            effect.Dispose();
                        }

                        this.units.Remove(unit);
                        continue;
                    }

                    if (unit.HealthPercentage > 25 ||
                        hero.GetAttackDamage(unit) - (unit.HealthRegeneration * hero.SecondsPerAttack) < unit.Health)
                    {
                        if (effect?.IsValid == true)
                        {
                            effect.Dispose();
                        }

                        continue;
                    }

                    if (effect?.IsValid == true)
                    {
                        continue;
                    }

                    effect = ParticleManager.CreateParticle(
                        "materials/ensage_ui/particles/illusions_mod_v2.vpcf",
                        ParticleAttachment.CenterFollow,
                        unit.BaseUnit);

                    effect.SetControlPoint(1, new Vector3(255));
                    effect.SetControlPoint(2, new Vector3(0, 255, 128));

                    this.units[unit] = effect;
                }

                if (this.units.Count == 0)
                {
                    this.handler.IsEnabled = false;
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 12
0
        private Particle DrawLine(Vector3 startPosition, Vector3 endPosition)
        {
            var line = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\line.vpcf", startPosition);

            line.SetControlPoint(2, endPosition);
            line.SetControlPoint(3, new Vector3(255, 15, 0));
            line.SetControlPoint(4, ParticleColor);

            return(line);
        }
Exemplo n.º 13
0
        public static void AddRedCircle(Vector3 position)
        {
            var red = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\drag_selected_ring_mod.vpcf", ParticleAttachment.CustomOrigin, null);

            red.SetControlPoint(0, position);
            red.SetControlPoint(1, new Vector3(255, 0, 0));
            red.SetControlPoint(2, new Vector3(70, 255, 0));

            Particles.Add(red);
        }
Exemplo n.º 14
0
        public void DrawCircle(Vector3 position, float radius)
        {
            if (this.circle != null)
            {
                return;
            }

            this.circle = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\drag_selected_ring_mod.vpcf", position);
            this.circle.SetControlPoint(1, ParticleColor);
            this.circle.SetControlPoint(2, new Vector3(radius * -1, 255, 0));
        }
Exemplo n.º 15
0
        private Particle DrawArc(Vector3 startPosition, Vector3 endPosition, float radius)
        {
            var arc = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\semicircle_v2.vpcf", startPosition);

            arc.SetControlPoint(1, endPosition);
            arc.SetControlPoint(2, new Vector3(radius * 1.12f, 0, 0));
            arc.SetControlPoint(3, ParticleColor);
            arc.SetControlPoint(4, new Vector3(255, 15, 0));

            return(arc);
        }
Exemplo n.º 16
0
        private void OnUpdate()
        {
            try
            {
                foreach (var unit in this.units)
                {
                    if (!unit.IsValid)
                    {
                        return;
                    }

                    if (!unit.IsVisibleToEnemies || !unit.IsAlive)
                    {
                        if (!this.particles.TryGetValue(unit, out var particle))
                        {
                            continue;
                        }

                        particle.Dispose();
                        this.particles.Remove(unit);
                    }
                    else
                    {
                        if (unit is RemoteMine)
                        {
                            // manual position update
                            if (this.particles.TryGetValue(unit, out var particle))
                            {
                                particle.SetControlPoint(0, unit.Position);
                            }
                            else
                            {
                                this.particles.Add(unit, ParticleManager.CreateParticle(this.effects[this.effectName], unit.Position));
                            }
                        }
                        else
                        {
                            if (this.particles.ContainsKey(unit))
                            {
                                continue;
                            }

                            this.particles.Add(
                                unit,
                                ParticleManager.CreateParticle(this.effects[this.effectName], ParticleAttachment.AbsOriginFollow, unit.BaseUnit));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 17
0
        private void DrawGlimpseParticle(Vector3 position)
        {
            if (this.targetParticleEffect == null)
            {
                this.targetParticleEffect = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\target.vpcf", position);
                this.targetParticleEffect.SetControlPoint(6, new Vector3(255));
            }

            this.targetParticleEffect.SetControlPoint(2, this.TargetManager.Target.Position);
            this.targetParticleEffect.SetControlPoint(5, this.color);
            this.targetParticleEffect.SetControlPoint(7, position);
        }
Exemplo n.º 18
0
        private void DrawTargetParticle()
        {
            if (this.targetParticleEffect?.IsValid != true)
            {
                this.targetParticleEffect = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\target.vpcf", this.Target.Position);
                this.targetParticleEffect.SetControlPoint(6, new Vector3(255));
            }

            this.targetParticleEffect.SetControlPoint(2, this.Owner.Hero.Position);
            this.targetParticleEffect.SetControlPoint(5, this.TargetLocked ? this.orangeRedColor : this.orangeColor);
            this.targetParticleEffect.SetControlPoint(7, this.Target.IsVisible ? this.Target.Position : this.Target.GetPredictedPosition());
        }
Exemplo n.º 19
0
        public static void DrawRedCircle(Vector3 position)
        {
            if (redParticle == null)
            {
                redParticle = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\drag_selected_ring_mod.vpcf", ParticleAttachment.CustomOrigin, null);
                greenParticle.SetControlPoint(0, position);
                redParticle.SetControlPoint(1, new Vector3(255, 0, 0));
                redParticle.SetControlPoint(2, new Vector3(70, 255, 0));
            }

            redParticle.SetControlPoint(0, position);
        }
Exemplo n.º 20
0
        private void RedrawRange()
        {
            if (this.particleEffect == null)
            {
                this.particleEffect = ParticleManager.CreateParticle(
                    @"particles\ui_mouseactions\drag_selected_ring.vpcf",
                    ParticleAttachment.AbsOriginFollow,
                    this.unit.BaseUnit);
            }

            this.particleEffect.SetControlPoint(1, new Vector3(this.red, this.green, this.blue));
            this.particleEffect.SetControlPoint(2, new Vector3(-this.DrawRange, 255, 0));
            this.particleEffect.FullRestart();
        }
Exemplo n.º 21
0
        public void DrawRange()
        {
            if (!this.IsShowingRange)
            {
                return;
            }

            if (this.RangeParticle != null)
            {
                this.RangeParticle.SetControlPoint(0, this.Position);
                return;
            }

            this.RangeParticle = ParticleManager.CreateParticle("particles/ui_mouseactions/drag_selected_ring.vpcf", this.Position);
            this.RangeParticle.SetControlPoint(1, this.RangeColor);
            this.RangeParticle.SetControlPoint(2, new Vector3(-this.Range, 255, 0));
        }
Exemplo n.º 22
0
    void Start()
    {
        v3_TargetRandomOffset = new Vector3(
            Random.Range(v3_TargetRandomOffset.x, -v3_TargetRandomOffset.x),
            Random.Range(v3_TargetRandomOffset.y, -v3_TargetRandomOffset.y),
            Random.Range(v3_TargetRandomOffset.z, -v3_TargetRandomOffset.z)
            );

        f_MaxSpeed = Vector3.Distance(finalPos, this.transform.position) / f_Time;

        f_AddSpeed = f_MaxSpeed * f_BeiShu;

        float angleX = Random.Range(TrackRandomOffset_UD.x, TrackRandomOffset_UD.y);

        float angleY = Random.Range(TrackRandomOffset_LR.x, TrackRandomOffset_LR.y);

        float angleZ = 0;


        Quaternion rotation = Quaternion.identity;

        //投掷时保证弧线向上
        if (target != null)
        {
            if (target.transform.position.z - this.gameObject.transform.position.z > 0)
            {
                rotation = Quaternion.Euler(angleX, angleY, angleZ);
            }
            else
            {
                rotation = Quaternion.Euler(-angleX, angleY, angleZ);
            }
        }
        Vector3 dir = (finalPos - this.transform.position).normalized;

        dir = rotation * dir;

        v3_Speed = dir * f_MaxSpeed;

        if (Ground_FX != null)
        {
            temp_Ground_FX = ParticleManager.CreateParticle(Ground_FX, transform.position);
            PartSystem_ONOFF(true);
        }
    }
Exemplo n.º 23
0
        private void OnAddEntity(EntityAddedEventArgs e)
        {
            try
            {
                if (this.sleeper)
                {
                    return;
                }

                var unit = e.Entity as Unit;
                if (unit == null || unit.Team == this.ownerTeam || unit.DayVision != 0 || unit.Name != "npc_dota_thinker")
                {
                    return;
                }

                if (unit.IsVisible && unit.Modifiers.All(x => x.Name != "modifier_radar_thinker"))
                {
                    return;
                }

                this.scanPosition = unit.Position;

                if (this.showOnMap)
                {
                    this.scanRadius = ParticleManager.CreateParticle("particles/ui_mouseactions/drag_selected_ring.vpcf", this.scanPosition);
                    this.scanRadius.SetControlPoint(1, new Vector3(255, 0, 0));
                    this.scanRadius.SetControlPoint(2, new Vector3(-GameData.ScanRadius, 255, 0));
                }

                this.sleeper.Sleep(this.ownerTeam == Team.Radiant ? GameManager.ScanCooldownDire : GameManager.ScanCooldownRadiant);

                RendererManager.Draw += this.OnDrawPosition;

                UpdateManager.BeginInvoke(GameData.ScanActiveTime * 1000,
                                          () =>
                {
                    RendererManager.Draw -= this.OnDrawPosition;
                    this.scanRadius?.Dispose();
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 24
0
        private void ParticleMangerOnParticleAdded(Particle9 particle)
        {
            try
            {
                //if (particle.Released)
                //{
                //    return;
                //}

                switch (particle.Name)
                {
                case "particles/units/heroes/hero_snapfire/hero_snapfire_ultimate_linger.vpcf":
                {
                    if (this.effects.Count == 0)
                    {
                        return;
                    }

                    var effect = this.effects.Dequeue();
                    if (effect.IsValid)
                    {
                        effect.Dispose();
                    }

                    break;
                }

                case "particles/units/heroes/hero_snapfire/snapfire_lizard_blobs_arced.vpcf":
                {
                    var effect = ParticleManager.CreateParticle(
                        "particles/units/heroes/hero_snapfire/hero_snapfire_ultimate_calldown.vpcf",
                        particle.GetControlPoint(1));
                    effect.SetControlPoint(1, this.radius);
                    effect.SetControlPoint(2, new Vector3(0.8f, 0, 0));

                    this.effects.Enqueue(effect);
                    break;
                }
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 25
0
        private void OnUnitAdded(Unit9 unit)
        {
            try
            {
                if (unit.Team == this.OwnerTeam || unit.Name != "npc_dota_treant_eyes")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle("particles/units/heroes/hero_treant/treant_eyesintheforest.vpcf", unit.Position);
                effect.SetControlPoint(1, this.radius);
                this.effects.Add(unit.Handle, effect);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 26
0
        private void CreateCPUExplosion(Vector2 explosionLocation, Color color)
        {
            for (int i = 0; i < CVars.Get <int>("particle_explosion_count"); i++)
            {
                float speed = CVars.Get <float>("particle_explosion_strength")
                              * NextRandomSingle(CVars.Get <float>("particle_explosion_variety_min"), CVars.Get <float>("particle_explosion_variety_max"));
                float dir = NextRandomSingle(0, MathHelper.TwoPi);

                ref VelocityParticleInfo info = ref _CPUParticleManager.CreateParticle(_particleTexture,
                                                                                       explosionLocation.X,
                                                                                       -explosionLocation.Y, // For various reasons, ParticleManager is flipped
                                                                                       color,
                                                                                       float.PositiveInfinity,
                                                                                       1,
                                                                                       0.5f);
                info.Velocity.X       = (float)(speed * Math.Cos(dir));
                info.Velocity.Y       = (float)(speed * Math.Sin(dir));
                info.LengthMultiplier = 1f;
            }
Exemplo n.º 27
0
        private void OnNetworkPropertyChanged(Entity sender, NetworkPropertyChangedEventArgs e)
        {
            if (e.PropertyName != "m_hTowerAttackTarget")
            {
                return;
            }

            var newValue = e.NewValue.GetUInt32();

            if (newValue == e.OldValue.GetUInt32())
            {
                return;
            }

            UpdateManager.BeginInvoke(() =>
            {
                try
                {
                    var unit = EntityManager9.GetUnit(newValue);
                    if (unit == null || !unit.IsHero || unit.IsIllusion || unit.Distance(this.owner) > 1000)
                    {
                        return;
                    }

                    this.effect?.Dispose();

                    this.effect = ParticleManager.CreateParticle(@"materials\ensage_ui\particles\target.vpcf", unit.Position);
                    this.effect.SetControlPoint(2, sender.Position);
                    this.effect.SetControlPoint(5, new Vector3(255, 0, 0));
                    this.effect.SetControlPoint(6, new Vector3(255));

                    this.tower             = (Tower)sender;
                    this.towerTarget       = unit;
                    this.handler.IsEnabled = true;
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            });
        }
Exemplo n.º 28
0
        private void OnParticleAdded(Particle9 particle)
        {
            try
            {
                //if (!particle.Released)
                //{
                //    return;
                //}

                switch (particle.Name)
                {
                case "particles/units/heroes/hero_ancient_apparition/ancient_apparition_ice_blast_final.vpcf":
                case "particles/econ/items/ancient_apparition/aa_blast_ti_5/ancient_apparition_ice_blast_final_ti5.vpcf":
                {
                    var startPosition = particle.GetControlPoint(0);
                    var endPosition   = particle.GetControlPoint(1);
                    var time          = GameManager.RawGameTime - (GameManager.Ping / 1000);
                    var flyingTime    = time - this.unitAddTime;
                    var direction     = startPosition + endPosition;
                    var position      = startPosition.Extend2D(direction, flyingTime * this.speed);
                    var radius        = Math.Min(this.maxRadius, Math.Max((flyingTime * this.growRadius) + this.minRadius, this.minRadius));

                    this.effect = ParticleManager.CreateParticle(
                        "particles/units/heroes/hero_ancient_apparition/ancient_apparition_ice_blast_marker.vpcf",
                        position.SetZ(384));     // todo correct z coord
                    this.effect.SetControlPoint(1, new Vector3(radius, 1, 1));
                    break;
                }

                case "particles/econ/items/ancient_apparition/aa_blast_ti_5/ancient_apparition_ice_blast_explode_ti5.vpcf":
                case "particles/units/heroes/hero_ancient_apparition/ancient_apparition_ice_blast_explode.vpcf":
                    Context9.ParticleManger.ParticleAdded -= this.OnParticleAdded;
                    this.effect?.Dispose();
                    break;
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 29
0
        private void OnParticleAdded(Particle9 particle)
        {
            try
            {
                if (/*!particle.Released || */ particle.Name != "particles/units/heroes/hero_gyrocopter/gyro_calldown_first.vpcf")
                {
                    return;
                }

                var effect = ParticleManager.CreateParticle(
                    "particles/units/heroes/hero_gyrocopter/gyro_calldown_marker.vpcf",
                    particle.GetControlPoint(1));
                effect.SetControlPoint(1, this.radius);

                effect.Release();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 30
0
        private void OnUpdate()
        {
            try
            {
                foreach (var unit in this.units)
                {
                    if (!unit.IsValid)
                    {
                        continue;
                    }

                    if (unit.IsLinkensProtected && unit.IsVisible && unit.IsAlive)
                    {
                        if (this.effects.ContainsKey(unit.Handle))
                        {
                            continue;
                        }

                        this.effects[unit.Handle] = ParticleManager.CreateParticle(
                            "particles/items_fx/immunity_sphere_buff.vpcf",
                            ParticleAttachment.CenterFollow,
                            unit.BaseUnit);
                    }
                    else
                    {
                        if (!this.effects.TryGetValue(unit.Handle, out var effect))
                        {
                            continue;
                        }

                        effect.Dispose();
                        this.effects.Remove(unit.Handle);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }