当前位置: 首页>>代码示例>>C#>>正文


C# Unit.AddParticleEffect方法代码示例

本文整理汇总了C#中Unit.AddParticleEffect方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.AddParticleEffect方法的具体用法?C# Unit.AddParticleEffect怎么用?C# Unit.AddParticleEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Unit的用法示例。


在下文中一共展示了Unit.AddParticleEffect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Unit_OnModifierAdded

 public static void Unit_OnModifierAdded(Unit sender, ModifierChangedEventArgs args)
 {
     if (_inTp)
         return;
     var name = args.Modifier.Name;
     if (name.Contains("teleporting"))
     {
         //Printer.Print($"{sender.Name}: teleporting");
         if (sender.ClassID == ClassID.CDOTA_Unit_Hero_Tinker)
         {
             _teleportCaster = sender;
         }
     }
     else if (name.Contains("modifier_boots_of_travel_incoming"))
     {
         //Printer.Print($"{sender.Name}: boots");
         if (sender.Team==Members.MyTeam)
         DelayAction.Add(new DelayActionItem(100, () =>
         {
             if (_teleportCaster != null)
             {
                 var blink = Members.MyHero.FindItem("item_blink", true);
                 if (blink != null)
                 {
                     var effect =
                         sender.AddParticleEffect("materials/ensage_ui/particles/range_display_mod.vpcf");
                     var lense = Members.MyHero.FindItem("item_aether_lens", true);
                     var range = 1150 + (lense != null ? 200 : 0);
                     effect.SetControlPoint(0, sender.Position);
                     effect.SetControlPoint(1, new Vector3(range, 255, 0));
                     effect.SetControlPoint(2, new Vector3(255, 255, 255));
                     Members.TowerRangEffectHelper.AddEffect(sender, effect);
                     //if (sender is Building)
                     //{
                         effect =
                             sender.AddParticleEffect("materials/ensage_ui/particles/line.vpcf");
                         var frontPoint = Helper.InFront(Members.MyHero, sender, range);
                         effect.SetControlPoint(1, sender.Position);
                         effect.SetControlPoint(2, frontPoint);
                         effect.SetControlPoint(3, new Vector3(255, 50, 0));
                         effect.SetControlPoint(4, new Vector3(255, 255, 255));
                         Members.TowerRangEffectHelper2.AddEffect(sender, effect,range);
                     //}
                     _inTp = true;
                 }
             }
         }, CancellationToken.None));
     }
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:49,代码来源:TeleportRangeHelper.cs

示例2: HandleEffect

 private static void HandleEffect(Unit unit)
 {
     if (!unit.IsValid)
     {
         return;
     }
     if (unit.IsVisibleToEnemies && unit.IsAlive)
     {
         ParticleEffect effect;
         if (!Effects.TryGetValue(unit, out effect))
         {
             effect = unit.AddParticleEffect("particles/items_fx/aura_shivas.vpcf");
             Effects.Add(unit, effect);
         }
     }
     else
     {
         ParticleEffect effect;
         if (Effects.TryGetValue(unit, out effect))
         {
             effect.Dispose();
             Effects.Remove(unit);
         }
     }
 }
开发者ID:LimbViolencer,项目名称:Ensage-2,代码行数:25,代码来源:Program.cs

示例3: HandleEffect

 private static void HandleEffect(Unit unit)
 {
     ParticleEffect effect;
     ParticleEffect effect2;
     if (unit.IsAlive && unit.IsVisibleToEnemies)
     {
         if (Effects1.TryGetValue(unit, out effect)) return;
         effect = unit.AddParticleEffect("particles/items2_fx/smoke_of_deceit_buff.vpcf"); //particles/items_fx/diffusal_slow.vpcf
         effect2 = unit.AddParticleEffect("particles/items2_fx/shadow_amulet_active_ground_proj.vpcf");
         Effects1.Add(unit, effect);
         Effects2.Add(unit, effect2);
     }
     else
     {
         if (!Effects1.TryGetValue(unit, out effect)) return;
         if (!Effects2.TryGetValue(unit, out effect2)) return;
         effect.Dispose();
         effect2.Dispose();
         Effects1.Remove(unit);
     }
 }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:21,代码来源:Program.cs

示例4: HandleEffect

        private static void HandleEffect(Unit unit)
        {
            ParticleEffect effect;
            if (unit.IsAlive && unit.IsVisibleToEnemies)
            {
                if (Visible.TryGetValue(unit, out effect)) return;

                unit.AddParticleEffect("particles/items2_fx/smoke_of_deceit_buff.vpcf");
                unit.AddParticleEffect("particles/items2_fx/shadow_amulet_active_ground_proj.vpcf");

                effect = unit.AddParticleEffect("particles/items_fx/aura_shivas.vpcf");

                Visible.Add(unit, effect);
            }
            else
            {
                if (!Visible.TryGetValue(unit, out effect)) return;
                effect.Dispose();
                Visible.Remove(unit);
            }
        }
开发者ID:luigiguido45,项目名称:goldilocks,代码行数:21,代码来源:Program.cs

示例5: UpdateEffect

        static void UpdateEffect( Unit unit, uint multiplier )
        {
            ParticleEffect effect;
            bool applyEffect = false;
            if(unit.Level % multiplier == 0 || unit.Level == 25)
                applyEffect = true;
            if(unit.IsAlive && applyEffect) {
                if(!Effects.TryGetValue( unit, out effect )) {
                    effect = unit.AddParticleEffect( EffectName );

                    Effects.Add( unit, effect );
                }
            } else {
                if(Effects.TryGetValue( unit, out effect )) {
                    effect.Dispose();
                    Effects.Remove( unit );
                }
            }
        }
开发者ID:MarkHC,项目名称:EnsageScripts,代码行数:19,代码来源:Program.cs

示例6: HandleEffect

        private static void HandleEffect(Unit unit)
        {
            ParticleEffect effect;
            if (unit.IsAlive && unit.IsVisibleToEnemies)
            {
                if (Visible.TryGetValue(unit, out effect)) return;

                effect = unit.AddParticleEffect("particles/items2_fx/smoke_of_deceit_buff.vpcf");
               	//asf
                Visible.Add(unit, effect);
            }
            else
            {
                if (!Visible.TryGetValue(unit, out effect)) return;
                effect.Dispose();
                Visible.Remove(unit);
            }
        }
开发者ID:MarkHC,项目名称:goldilocks,代码行数:18,代码来源:Program.cs

示例7: HandleEffectR

        private static void HandleEffectR(Unit unit)
        {
            if (unit == null) return;
            ParticleEffect effect;
            me = ObjectMgr.LocalHero;
            if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tinker)
                return;
			
            if (unit.Modifiers.Any(y => y.Name == "modifier_boots_of_travel_incoming") && me.HasModifier("modifier_teleporting"))
            {
                if (VisibleUnit.TryGetValue(unit, out effect)) return;
                effect = unit.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
				range_dagger = 1200 + aetherrange + 130;
				effect.SetControlPoint(1, new Vector3(150, 255, 255));
				effect.SetControlPoint(2, new Vector3(range_dagger, 255, 0));
                VisibleUnit.Add(unit, effect);
            }
            else
            {
                if (!VisibleUnit.TryGetValue(unit, out effect)) return;
                effect.Dispose();
                VisibleUnit.Remove(unit);
            }
        }
开发者ID:Air13,项目名称:ESharp,代码行数:24,代码来源:Tinker_Air13.cs

示例8: HandleEffect

        private static void HandleEffect(Unit unit, string effectName)
        {
            if (unit == null) return;
            Vector2 screenPos;
            ParticleEffect effect;

            var enemyPos = unit.Position + new Vector3(0, 0, unit.HealthBarOffset);
            if (Drawing.WorldToScreen(enemyPos, out screenPos) && unit.IsVisibleToEnemies && unit.IsAlive)
            {
                if (VisibleUnit.TryGetValue(unit, out effect)) return;
                effect = unit.AddParticleEffect("particles/" + effectName + ".vpcf");
                VisibleUnit.Add(unit, effect);
            }
            else
            {
                if (!VisibleUnit.TryGetValue(unit, out effect)) return;
                effect.Dispose();
                VisibleUnit.Remove(unit);
            }
        }
开发者ID:vitac1998,项目名称:ensagesharp-1,代码行数:20,代码来源:Program.cs

示例9: OnCalc

        public static void OnCalc(EventArgs args)
        {
            if (_rangeEfeectMaster == null)
                _rangeEfeectMaster = new LineHelpers();
            if (_debugLines == null)
                _debugLines = new DebugLines();

            var tempTarget = TargetSelector.ClosestToMouse(Members.MyHero);
            if ((tempTarget == null && Target != null) || (tempTarget!=null && Target!=null && !tempTarget.Equals(Target)))
            {
                if (Target != null)
                {
                    var i = 0;
                    while (_debugLines.Dispose(Target))
                    {
                        Printer.Print($"[Dispose]# {++i}");
                    }
                }
                if (_targetRange != null)
                {
                    _targetRange.Dispose();
                    _targetRange = null;
                }
            }
            Target = tempTarget;
            if (Target==null)
                return;
            if (_targetRange == null)
            {
                if (DrawRange)
                {
                    _targetRange =
                        Target.AddParticleEffect("materials/ensage_ui/particles/range_display_mod.vpcf");
                    _targetRange.SetControlPoint(1, new Vector3(575, 255, 0));
                    _targetRange.SetControlPoint(2, new Vector3(75, 75, 75));
                }
            }
            var trees = ObjectManager.GetEntities<Entity>()
                .Where(x => x.Name == "ent_dota_tree" && x.IsAlive && x.IsValid && x.Distance2D(Target.Position) < 575 && x.IsAlive).ToList();

            var units = ObjectManager.GetEntities<Unit>()
                .Where(
                    x =>
                        !Target.Equals(x) && x.Distance2D(Target.Position) < 575 && x.IsAlive &&
                        x.Team == Members.MyHero.GetEnemyTeam() && x.IsVisible).ToList();

            //trees.AddRange(units);
            var list=new List<Vector3>();
            foreach (var entity in trees)
            {
                var angle = (float)Math.Max(
                    Math.Abs(Members.MyHero.FindAngleBetween(entity.Position, true) -
                             Members.MyHero.FindAngleBetween(Target.Position, true)) - .21, 0);
                _rangeEfeectMaster.DrawEffect(entity, "materials/ensage_ui/particles/line.vpcf", angle == 0);
                _debugLines.DrawEffect(entity, "materials/ensage_ui/particles/line.vpcf", angle == 0);

                var ang = Target.FindAngleBetween(entity.Position, true);
                for (var i = 1; i < 16; i++)
                {
                    var tempPos = Target.Position -
                          new Vector3((float)(i * 50 * Math.Cos(ang)), (float)(i * 50 * Math.Sin(ang)), 0);
                    if (NavMesh.GetCellFlags(tempPos) == NavMeshCellFlags.Walkable)
                        list.Add(tempPos);
                }

            }

            foreach (var entity in units)
            {
                var angle = (float)Math.Max(
                    Math.Abs(Members.MyHero.FindAngleBetween(entity.Position, true) -
                             Members.MyHero.FindAngleBetween(Target.Position, true)) - .21, 0);
                _rangeEfeectMaster.DrawEffect(entity, "materials/ensage_ui/particles/line.vpcf", angle == 0);
                _debugLines.DrawEffect(entity, "materials/ensage_ui/particles/line.vpcf", angle == 0);
                var ang = Target.FindAngleBetween(entity.Position, true);
                for (var i = 1; i < 16; i++)
                {
                    var tempPos = Target.Position -
                          new Vector3((float)(i * 50 * Math.Cos(ang)), (float)(i * 50 * Math.Sin(ang)), 0);
                    if (NavMesh.GetCellFlags(tempPos) == NavMeshCellFlags.Walkable)
                        list.Add(tempPos);
                }
            }
            Members.BestPoinits = list;
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:85,代码来源:ShackleshotCalculation.cs

示例10: HandleEffect

        public static void HandleEffect(Unit unit)
        {
            ParticleEffect effect;
            ParticleEffect effect2;
            if (unit.IsAlive /* && unit.IsVisibleToEnemies*/)
            {
                if (Members.Effects1.TryGetValue(unit, out effect)) return;
                var id = IllusionType;
                effect = unit.AddParticleEffect(Members.ShowIllusionList[id]);
                switch (id)
                {
                    case 0:
                        effect2 = unit.AddParticleEffect(Members.ShowIllusionList[Members.ShowIllusionList.Count-1]);
                        Members.Effects2.Add(unit, effect2);
                        break;
                    default:
                        effect.SetControlPoint(1, new Vector3(IllusionSize, IllusionAlpha, 0));
                        effect.SetControlPoint(2, IllusionColor);
                        break;
                }

                Members.Effects1.Add(unit, effect);
            }
            else
            {
                if (!Members.Effects1.TryGetValue(unit, out effect)) return;
                effect.Dispose();

                Members.Effects1.Remove(unit);
                if (!Members.Effects2.TryGetValue(unit, out effect2)) return;
                effect2.Dispose();
                Members.Effects2.Remove(unit);
            }
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:34,代码来源:Helper.cs


注:本文中的Unit.AddParticleEffect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。