Example #1
0
        public void Execute(AbilityCommandContext ctx)
        {
            var entityManager = Game.Instance.gameLogicManager.entityManager;
            var caster        = entityManager.GetEntity(ctx.caster);
            var target        = entityManager.GetEntity(ctx.target);

            var tp = Entity.Create(EntityType.TrackingProjectile);

            entityManager.AddEntity(tp);
            tp.collider.size         = m_VisionRadius;
            tp.collider.selfLayer    = (int)Collider.Layer.Projectile;
            tp.collider.maskLayer    = (int)Collider.Layer.Hero;
            tp.movement.defaultSpeed = tp.movement.speed = m_MoveSpeed;
            tp.tracker.target        = target.id;
            tp.position.position     = caster.position.position;
            tp.active         = true;
            tp.model.name     = "tp caster:" + caster.ToString() + " target:" + target.ToString();
            tp.model.position = caster.position.position;
            // tp.model.material.color = UnityEngine.Color.red;
            tp.camp.type = caster.camp.type;

            tp.collider.onCollide = (projectile, other) =>
            {
                if (ctx.target != other.id)
                {
                    return;
                }
                if (ctx.triggers.ContainsKey(AbilityEventTrigger.OnProjectileHitUnit))
                {
                    ctx.triggers[AbilityEventTrigger.OnProjectileHitUnit].Invoke(other.id);
                }

                Entity.Destroy(projectile);
            };
        }
Example #2
0
        public void Execute(AbilityCommandContext ctx)
        {
            var entityManager = Game.Instance.gameLogicManager.entityManager;
            var target        = entityManager.GetEntity(ctx.target);

            if (target != null)
            {
                LogicHelper.DoDamage(m_DamageType, m_DamageValue, target);
            }
        }
Example #3
0
        public void Execute(AbilityCommandContext ctx)
        {
            var entityManager = Game.Instance.gameLogicManager.entityManager;
            var target        = entityManager.GetEntity(ctx.target);

            if (target != null)
            {
                target.property.magicImmuneBuffCount += m_MagicImmuneValue;
            }
        }
Example #4
0
        public void Execute(AbilityCommandContext ctx)
        {
            var entityManager = Game.Instance.gameLogicManager.entityManager;
            var target        = entityManager.GetEntity(ctx.target);

            if (target != null)
            {
                // TODO 20180107 攻速 property
            }
        }
Example #5
0
 protected void ExecuteCommands(ModifierContext context)
 {
     if (m_Commands != null)
     {
         var ctx = new AbilityCommandContext
         {
             caster = context.caster,
             target = context.owner
         };
         foreach (var cmd in m_Commands)
         {
             cmd.Execute(ctx);
         }
     }
 }
Example #6
0
        private void ExecuteImpl(int target)
        {
            var cmdCtx = new AbilityCommandContext
            {
                caster    = m_Context.caster,
                target    = target,
                modifiers = m_Context.modifiers,
                triggers  = m_Context.triggers
            };

            foreach (var cmd in commands)
            {
                cmd.Execute(cmdCtx);
            }
        }
Example #7
0
 protected void ExecuteCommands(AbilityContext ctx)
 {
     if (commands != null)
     {
         var cmdCtx = new AbilityCommandContext();
         cmdCtx.caster    = ctx.caster;
         cmdCtx.modifiers = ctx.modifiers;
         cmdCtx.triggers  = ctx.triggers;
         foreach (var cmd in commands)
         {
             foreach (var target in ctx.targets)
             {
                 cmdCtx.target = target;
                 cmd.Execute(cmdCtx);
             }
         }
     }
 }
Example #8
0
        public void Execute(AbilityCommandContext ctx)
        {
            var entityManager = Game.Instance.gameLogicManager.entityManager;
            var target        = entityManager.GetEntity(ctx.target);

            if (target != null)
            {
                ModifierRoot modifier;
                if (ctx.modifiers.TryGetValue(m_ModifierName, out modifier))
                {
                    modifier         = modifier.Clone() as ModifierRoot;
                    modifier.context = new ModifierContext()
                    {
                        caster = ctx.caster,
                        owner  = target.id,
                    };

                    target.modifier.AddModifier(modifier);
                }
            }
        }