예제 #1
0
 public void PlayEndFx(float second)
 {
     if (displayInfor.EndEffect.Length > 0)
     {
         AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + displayInfor.EndEffect);
         if (inf.isDone(false))
         {
             EndFxObj = inf.CloneGameObject();
             EndFxObj.transform.parent        = hero.transform;
             EndFxObj.transform.localPosition = Vector3.zero;
             ObjectUtil.SetTagWithAllChildren(EndFxObj, CameraLayerManager.GetInstance().GetMissionSignName());
             if (displayInfor.EndEffectBindPoint.Length == 0 || displayInfor.BeginEffectBindPoint.CompareTo("Ground") == 0)
             {
                 EndFxObj.transform.localRotation = Quaternion.identity;
                 EndFxObj.transform.localScale    = Vector3.one;
             }
             else
             {
                 Transform t = hero.GetChildTransform(displayInfor.BeginEffectBindPoint);
                 if (null != t)
                 {
                     EndFxObj.transform.parent        = t;
                     EndFxObj.transform.localPosition = Vector3.zero;
                     EndFxObj.transform.localRotation = Quaternion.identity;
                     EndFxObj.transform.localScale    = Vector3.one;
                     EndFxObj.transform.parent        = hero.transform;
                 }
             }
             if (!displayInfor.EndEffectBind)
             {
                 EndFxObj.transform.parent = hero.transform.parent;
             }
             ParticleSystemScaleManager.ScaleParticle(EndFxObj);
             KingSoftCommonFunction.SetLayer(EndFxObj, 11);
             EndFxObj.SetActive(true);
             DestoryObject dos = EndFxObj.AddComponent <DestoryObject>();
             dos.delta = second;
         }
     }
     if (hitTicker.isPlaying())
     {
         OnHit();
     }
 }
예제 #2
0
    void OnHit()
    {
        if (displayInfor.CameraEffect.CompareTo("SHAKE_HIT") == 0)
        {
            Shake();
        }
        if (displayInfor.BulletEffect.Length > 0 && target != null)
        {
            hero.property.AutoAttack = false;

            GameObject bulletObj = null;
            AssetInfo  inf       = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + displayInfor.BulletEffect);
            if (inf.isDone(false))
            {
                bulletObj = inf.CloneGameObject();
            }
            else
            {
                bulletObj = new GameObject();
            }
            bulletObj.transform.position = hero.transform.position;
            bulletObj.SetActive(true);
            KingSoftCommonFunction.SetLayer(bulletObj, 11);
            Bullet bullet = bulletObj.AddComponent <Bullet>();
            bullet.msg_case     = msg_case;
            msg_case            = null;
            bullet.displayInfor = displayInfor;
            bullet.hero         = hero;
            bullet.target       = target;
            bullet.speed        = (activeSkill.SkillFlySpeed / 100);
            bullet.hitFx        = displayInfor.HitEffect;
        }
        else
        {
            if (displayInfor.SoundType == KSkillDisplay.ACTION_AUIDO_TYPE.Hit)
            {
                if (displayInfor.Sound.Length > 0)
                {
                    AudioManager.instance.PlaySound3d(displayInfor.Sound, hero.Position);
                }
            }
            PopMsg();
        }
    }
예제 #3
0
        //播放战斗效果
        public void PlayFightEffect(ushort wSkillID, int damage, byte byAttackEvent, SceneEntity killerHero)
        {
            if (byAttackEvent == (byte)KAttackEvent.aeMiss)
            {
                if (Owner.property.isMainHero)
                {
                    Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "2", "FightFont", "effect_ui_shuzitanchu_putong.res");
                }
                else
                {
                    Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "1", "FightFont", "effect_ui_shuzitanchu_putong.res");
                }
                return;
            }
            else if (byAttackEvent == (byte)KAttackEvent.aeCrit)
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "CritFont", "effect_ui_shuzitanchu_baoji2.res");
            }
            else if (Owner.property.isMainHero)
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "HurtFont", "effect_ui_shuzitanchu_putong.res", NumTip.OFFSET_TYPE.LEFT);
            }
            else
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "AttackFont", "effect_ui_shuzitanchu_putong.res");
            }
            KSkillDisplay skillDisplay = KConfigFileManager.GetInstance().GetSkillDisplay(wSkillID, Owner.TabID);

            if (skillDisplay.OnHitAction.CompareTo("JUMP") == 0)
            {
                ActionBeAttactedAndThrowUp action = new ActionBeAttactedAndThrowUp(Owner);
                action.hitAnim     = skillDisplay.OnHitAnim;
                action.time        = skillDisplay.OnHitEffecTime;
                action.height      = skillDisplay.OnHitHeight;
                Owner.ActiveAction = action;
                //action
            }
            else if (Owner.property.heroObjType == KHeroObjectType.hotMonster && Owner.heroSetting.MonsterGrade == KMonsterGrade.mgQuestBoss)
            {
                if (Owner.property.activeAction.TryFinish())
                {
                    ActiionBeAttack beAttack = new ActiionBeAttack(Owner);
                    Owner.DispatchEvent(ControllerCommand.SetActiveAction, beAttack);
                }
            }
            else
            {
                Owner.DispatchEvent(ControllerCommand.BE_HIT);
            }

            Vector3 forward = Vector3.forward;

            if (null != killerHero)
            {
                forward = killerHero.transform.position - Owner.transform.position;
                forward = new Vector3(forward.x, 0, forward.z);
                forward.Normalize();
            }
            if (skillDisplay.HitShakeTime > 0 && skillDisplay.HitShakeDelta > 0)
            {
                Owner.DispatchEvent(ControllerCommand.HIT_SLOW, skillDisplay.HitShakeTime, skillDisplay.HitShakeDelta);
            }

            if (null != skillDisplay && skillDisplay.HitEffect.Length > 0 /*&& skillDisplay.BulletEffect.Length == 0*/)
            {
                AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + skillDisplay.HitEffect);
                if (inf.isDone(false))
                {
                    if (skillDisplay.SingleHitFx)
                    {
                        GameObject _hit = null;
                        if (hitFxs.TryGetValue(skillDisplay.HitEffect, out _hit))
                        {
                            GameObject.Destroy(_hit);
                        }
                    }
                    GameObject hitObject = inf.CloneGameObject();
                    ObjectUtil.SetTagWithAllChildren(hitObject, CameraLayerManager.GetInstance().GetMissionSignName());
                    hitObject.transform.parent   = Owner.transform.parent;
                    hitObject.transform.position = Owner.transform.position;
                    hitObject.transform.forward  = forward;
                    if (skillDisplay.SingleHitFx)
                    {
                        hitFxs[skillDisplay.HitEffect] = hitObject;
                    }
                    KingSoftCommonFunction.SetLayer(hitObject, 11);
                    DestoryObject dos = hitObject.AddComponent <DestoryObject>();
                    dos.delta = 5;
                    if (skillDisplay.HitBindPoint.Length > 0)
                    {
                        if (skillDisplay.HitBindPoint.CompareTo("Ground") != 0)
                        {
                            Transform t = Owner.GetChildTransform(skillDisplay.HitBindPoint);
                            if (null != t)
                            {
                                hitObject.transform.parent        = t;
                                hitObject.transform.localPosition = Vector3.zero;
                                hitObject.transform.localScale    = Vector3.one;
                            }
                        }
                    }
                    hitObject.SetActive(true);
                }
            }
        }