コード例 #1
0
        private bool OnAttackLanded(EvtAttackLanded evt)
        {
            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.attackeeID);

            if (actor == null)
            {
                return(false);
            }
            AttackPattern.ActAttackEffects(this.config.AttackEffect, actor.entity, evt.attackResult.hitCollision.hitPoint, evt.attackResult.hitCollision.hitDir);
            return(true);
        }
コード例 #2
0
ファイル: AvatarActor.cs プロジェクト: slb1988/agame
 public void FireAttackDataEffects(AttackResult attackResult)
 {
     if ((attackResult.attackEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyAttack)))
     {
         AttackPattern.ActAttackEffects(attackResult.attackEffectPattern, this.avatar, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir);
     }
     if (attackResult.attackCameraShake != null)
     {
         AttackPattern.ActCameraShake(attackResult.attackCameraShake);
     }
 }
コード例 #3
0
ファイル: PropObjectActor.cs プロジェクト: slb1988/agame
        private bool OnBeingHitResolve(EvtBeingHit evt)
        {
            evt.Resolve();
            AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData);

            if (attackResult.hitCollision == null)
            {
                AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                    hitPoint = this.prop.RootNode.position,
                    hitDir   = -this.prop.transform.forward
                };
                attackResult.hitCollision = collsion;
            }
            if (!evt.attackData.isAnimEventAttack)
            {
                return(false);
            }
            if (base.isAlive != 0)
            {
                float totalDamage = attackResult.GetTotalDamage();
                float newValue    = base.HP - totalDamage;
                if (newValue <= 0f)
                {
                    newValue = 0f;
                }
                DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged);
                if (base.HP == 0f)
                {
                    if (base.abilityState.ContainsState(AbilityState.Limbo))
                    {
                        this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID);
                    }
                    else
                    {
                        this.BeingHit(attackResult, BeHitEffect.KillingBeHit, evt.sourceID);
                        this.Kill(evt.sourceID, evt.animEventID);
                    }
                }
                else
                {
                    this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID);
                }
            }
            if ((attackResult.attackEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyAttack)))
            {
                AttackPattern.ActAttackEffects(attackResult.attackEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir);
            }
            if ((attackResult.beHitEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyBeHit)))
            {
                AttackPattern.ActAttackEffects(attackResult.beHitEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir);
            }
            if (evt.attackData.isAnimEventAttack)
            {
                EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult);
                Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal);

                Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed));
            }
            else
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal);
            }
            return(true);
        }