Ejemplo n.º 1
0
    /// <summary>
    /// 死亡的前端表现.
    /// </summary>
    private void createDeathClientBehaviour(ImpactDamageType damageType, AttackerAttr killerAttr)
    {
        // 材质死亡(特效).
        ErrorHandler.Parse(
            mOwner.AddMaterialBehaviour(MaterialBehaviourDef.OnMaterialDie, damageType, killerAttr.EffectStartDirection),
            "failed to add death material effect"
            );

        // 死亡动作.
        MecanimStateController stateControl = mOwner.GetStateController();
        AnimatorProperty       animSet      = stateControl.AnimSet;

        if (animSet != null && !string.IsNullOrEmpty(mOwner.GetDeathAnimation()))        //animSet.NumOfDie > 0)
        {
            AnimActionDeath death = AnimActionFactory.Create(AnimActionFactory.E_Type.Death) as AnimActionDeath;
            death.dieAnim = mOwner.GetDeathAnimation();
            if (stateControl.AnimSet != null)
            {
                mDieAnimationHashCode = stateControl.AnimSet.GetStateHash(death.dieAnim);
            }
            stateControl.DoAction(death);
        }


        //mOwner.SetDeathMaterial("dssipate");
        //mOwner.SetDeathMaterial("burn_out");
        // 死亡声音.
        if (mOwner.GetDeadSound() != -1)
        {
            SoundManager.Instance.Play(mOwner.GetDeadSound());
        }
    }
Ejemplo n.º 2
0
 //死了
 protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
 {
     if (mPaoPao != null)
     {
         mPaoPao.Hide();
     }
     HideShadow();
     base.onDie(killerAttr, impactDamageType);
 }
Ejemplo n.º 3
0
    protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        if (!mMainPlayer)
        {
            BossBloodUIManager.Instance.ChangeHp(mGhostData.name, "touxiang:head" + mGhostData.resId.ToString(), GetLevel(), 0, GetMaxHP(), GetMaxHP(), IsFury());
        }

        base.onDie(killerAttr, impactDamageType);
    }
Ejemplo n.º 4
0
    protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        base.onDie(killerAttr, impactDamageType);

        mScene.OnMainPlayerDie();

        if (mHeadNode != null)
        {
            mHeadNode.Hide();
        }
    }
Ejemplo n.º 5
0
    protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        base.onDie(killerAttr, impactDamageType);
        if (mBloodNode != null)
        {
            mBloodNode.Hide();
        }
        int xx = GetHP();

        Scene.OnCropsDie();
    }
Ejemplo n.º 6
0
    protected override void onDie(AttackerAttr attackerAttr, ImpactDamageType impactDamageType)
    {
        SkillDetails.SelectTargetAndAddSkillEffect(mSummonerAttr, GetPosition(), GetDirection(),
                                                   mTrapResource.targetSelectionOnExplode,
                                                   mTrapResource.skillEffectOnExplode
                                                   );

        SkillClientBehaviour.AddSceneEffect(mTrapResource._3DEffectOnExplode, GetPosition());

        base.onDie(attackerAttr, impactDamageType);
    }
Ejemplo n.º 7
0
    public void AddDelayBehaviour(BattleUnit obj, MaterialBehaviourDef name, ImpactDamageType impactDamageType, float dir, float time = 0.0f)
    {
        DelayBehaviourNode node = new DelayBehaviourNode();

        node.mOwner           = obj;
        node.name             = name;
        node.impactDamageType = impactDamageType;
        node.dir  = dir;
        node.time = time;

        nodes.Add(node);
    }
Ejemplo n.º 8
0
    public void Start(BattleUnit owner, ImpactDamageType damageType, AttackerAttr killerAttr)
    {
        if (!IsRunning)
        {
            IsRunning = true;
            mOwner    = owner;

            createDeathClientBehaviour(damageType, killerAttr);

            onStarted(killerAttr);
        }
    }
Ejemplo n.º 9
0
    protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        AnimActionDeath death = AnimActionFactory.Create(AnimActionFactory.E_Type.Death) as AnimActionDeath;

        death.dieAnim = "Base Layer." + mRes.die_ani;
        GetStateController().DoAction(death);

        DisplayDieEffect();

        //DestroyBornEffect();

        base.onDie(killerAttr, impactDamageType);
    }
Ejemplo n.º 10
0
    public bool Die(AttackerAttr killerAttr, ImpactDamageType impactDamageType = ImpactDamageType.Invalid)
    {
        if (!IsDead())
        {
            AddActiveFlag(ActiveFlagsDef.IsDead, true, true);

            onDie(killerAttr, impactDamageType);

            if (mScene != null)
            {
                mScene.OnKillEnemy(this, killerAttr.AttackerID);
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 11
0
    protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        if (mRes.bossHpUnit > 0)
        {
            BossBloodUIManager.Instance.ChangeHp(mRes.name, mRes.headicon, GetLevel(), 0, GetMaxHP(),
                                                 mRes.bossHpUnit, IsFury());

            GameScene scene = mScene as GameScene;
            if (scene != null)
            {
                scene.BossDeadPos = GetPosition();
            }
        }

        if (mBloodNode != null)
        {
            mBloodNode.Hide();
        }

        base.onDie(killerAttr, impactDamageType);
    }
Ejemplo n.º 12
0
    /// <summary>
    /// 添加材质特效和声音.
    /// </summary>
    public ErrorCode AddMaterialBehaviour(MaterialBehaviourDef name, ImpactDamageType impactDamageType, float dir)
    {
        // 无效的伤害类型.
        if (impactDamageType >= ImpactDamageType.Count)
        {
            return(ErrorCode.Succeeded);
        }

        if (name != MaterialBehaviourDef.OnMaterialDie && IsDead())
        {
            return(ErrorCode.TargetIsDead);
        }

        if (name == MaterialBehaviourDef.OnMaterialDie)
        {
            uint materialID = GetMaterialResourceID();

            if (materialID == uint.MaxValue)
            {
                ErrorHandler.Parse(ErrorCode.ConfigError, dbgGetIdentifier() + " 没有材质!");
                return(ErrorCode.ConfigError);
            }

            MaterialTableItem material = DataManager.MaterialTable[materialID] as MaterialTableItem;
            if (material == null)
            {
                SkillUtilities.ResourceNotFound("material", materialID);
                return(ErrorCode.ConfigError);
            }

            if (material.deathEffectWaitTime > 0)
            {
                Scene.GetDelayBehaviourManager().AddDelayBehaviour(this, name, impactDamageType, dir, material.deathEffectWaitTime);
                return(ErrorCode.Succeeded);
            }
        }

        return(SkillDetails.AddMaterialBehaviour(this, mHitMaterialEffectCdContainer, name, impactDamageType, dir));
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 添加材质特效和声音.
    /// </summary>
    /// <param name="owner">被添加特效和声音的单位</param>
    /// <param name="cdContainer">cd的容器, 该函数会检查并设置CD.</param>
    /// <param name="name">添加的类型(被击, 死亡等)</param>
    /// <param name="impactDamageType">impact的伤害类型</param>
    public static ErrorCode AddMaterialBehaviour(BattleUnit owner, HitMaterialEffectCdContainer cdContainer,
                                                 MaterialBehaviourDef name, ImpactDamageType impactDamageType, float dir
                                                 )
    {
        // 无效的伤害类型.
        if (impactDamageType >= ImpactDamageType.Count)
        {
            return(ErrorCode.Succeeded);
        }

        // CD中, 只有被击的材质特效有CD, 死亡材质特效没有CD.
        if (name == MaterialBehaviourDef.OnMaterialBeHit && cdContainer.IsCoolingDown(impactDamageType))
        {
            return(ErrorCode.CoolingDown);
        }

        uint materialID = owner.GetMaterialResourceID();

        if (materialID == uint.MaxValue)
        {
            ErrorHandler.Parse(ErrorCode.ConfigError, owner.dbgGetIdentifier() + " 没有材质!");
            return(ErrorCode.ConfigError);
        }

        MaterialTableItem material = DataManager.MaterialTable[materialID] as MaterialTableItem;

        if (material == null)
        {
            SkillUtilities.ResourceNotFound("material", materialID);
            return(ErrorCode.ConfigError);
        }

        if (name == MaterialBehaviourDef.OnMaterialBeHit)
        {
            cdContainer.StartCd(impactDamageType);
        }

        MaterialItem item = material.items[(int)impactDamageType];

        uint   effectID  = uint.MaxValue;
        uint   sound     = uint.MaxValue;
        string bindpoint = "";

        switch (name)
        {
        case MaterialBehaviourDef.OnMaterialBeHit:
            effectID  = item.hitEffect;
            bindpoint = material.hitEffectBindpoint;
            sound     = item.sound;
            // 被击材质特效在被击者身上播放.
/*				SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir);*/
            if (string.IsNullOrEmpty(bindpoint))
            {
                SkillClientBehaviour.AddSceneEffect(effectID, owner.GetPosition(), dir);
            }
            else
            {
                SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir);
            }
            break;

        case MaterialBehaviourDef.OnMaterialDie:
            effectID  = item.deathEffect;
            bindpoint = material.deathEffectBindpoint;
            if (string.IsNullOrEmpty(bindpoint))
            {
                SkillClientBehaviour.AddSceneEffect(effectID, owner.GetPosition(), dir);
            }
            else
            {
                SkillClientBehaviour.AddEffect2Object(owner, effectID, bindpoint, dir);
            }

            break;

        default:
            break;
        }

        if (sound != uint.MaxValue)
        {
            SkillClientBehaviour.PlaySound(sound);
        }

        return(ErrorCode.Succeeded);
    }
Ejemplo n.º 14
0
    protected virtual void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType)
    {
        MaterialTableItem material = null;
        uint materialID            = GetMaterialResourceID();

        if (materialID != uint.MaxValue)
        {
            material = DataManager.MaterialTable[materialID] as MaterialTableItem;
        }
        bool operate = false;

        //根据材质修正尸体的存在时间
        if (impactDamageType < ImpactDamageType.Count)
        {
            if (material != null)
            {
                MaterialItem item = material.items[(int)impactDamageType];
                if (item.deatdelay >= 0)
                {
                    mWaitTime      = item.deatdelay;
                    mDisappearTime = 0;
                    operate        = true;
                }
            }
        }

        if (!operate)
        {
            mWaitTime      = mMaxWaitDisappearTime;
            mDisappearTime = mMaxDisappearTime;
        }

        // 检查击杀的随机事件.
        BattleUnit killer = killerAttr.CheckedAttackerObject();

        // 检查是否是自杀.
        if (killer != null && InstanceID != killerAttr.AttackerID)
        {
            killer.OnKillOther(killerAttr, this);
        }

        // 系统回收不触发死亡事件, 自杀依然触发.
        // 如果凶手通过随机事件杀死this, 那么不触发this的随机事件.
        if (killerAttr.AttackerID != uint.MaxValue && !killerAttr.StructMadeByRandEvent)
        {
            ApplyRandEvent(killer, RandEventTriggerType.OnBeKilled, new OnBeKilledEventArg(killerAttr));
        }

        // 通知skilleffect的清理.
        SkillDetails.OnSkillEffectOwnerEvent(mSkillEffectManager, SkillEffectOwnerEventDef.OwnerDie);

        if (material != null && impactDamageType < ImpactDamageType.Count)
        {
            MaterialItem item = material.items[(int)impactDamageType];
            if (item.mtl)
            {
                ////火死亡
                if (impactDamageType == ImpactDamageType.Fire)
                {
                    SetDeathMaterial("burn_out");
                }
                ////毒死亡
                if (impactDamageType == ImpactDamageType.Poison)
                {
                    SetDeathMaterial("poison");
                }
                //冰死亡
                if (impactDamageType == ImpactDamageType.Frost)
                {
                    SetDeathMaterial("iceimpact");
                }
            }
        }

        // 死亡特效, 声音, 动作等.
        // 当所有的效果, 动作都结束时, 开始死亡动作.
        if (mActionCenter != null)
        {
            ErrorHandler.Parse(
                mActionCenter.StartAction(new ActionDieInitParam()
            {
                attackerAttr = killerAttr, damageType = impactDamageType
            }),
                "failed to create action die"
                );
        }

        DieAward(killerAttr.AttackerID);
    }
Ejemplo n.º 15
0
 public void StartCd(ImpactDamageType damageType)
 {
     cdContainer[(int)damageType] = kHitMaterialCd;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 返回指定类型的被击材质特效是否在CD时间内.
 /// </summary>
 public bool IsCoolingDown(ImpactDamageType damageType)
 {
     return(cdContainer[(int)damageType] != 0);
 }