Esempio n. 1
0
    // 状态处理
    public void Process(EntityParent theOwner, params object[] args)
    {
        theOwner.SetSpeed(0);
        Vector3 oldDir = theOwner.entityActor.moveDir;

        theOwner.entityActor.moveDir = Vector3.zero;
        //创建眩晕特效
        uint time = (uint)((float)args[0] * 1000);

        theOwner.timer.Add(TimerManager.AddTimer(time, 0, () =>
        {
            theOwner.entityActor.moveDir = oldDir;
            theOwner.Move();
        }));
    }
 public void Process(EntityParent entity, params object[] args)
 {
     if (entity is EntityMyself && SkillManager.singleton.HasSkillRunning())
     {
         
     }
     else
     {
         entity.PlayAnimation("OnHit");
     }       
     oldMove = entity.entityActor.moveDir;
     entity.entityActor.moveDir = Vector3.zero;
     //受击特效
     Skill skill = args[0] as Skill;
     if (skill != null || (skill == null && entity is EntityMyself))
     {
         string path = string.Empty;
         if (skill == null)
         {
             path = "Assets.Prefabs.Effects.Hit.HitBai.prefab";
         }
         else
         {
             switch (skill.hitType)
             {
                 case OnHitEffectType.白色:
                     path = "Assets.Prefabs.Effects.Hit.HitBai.prefab";
                     break;
                 case OnHitEffectType.橙色:
                     path = "Assets.Prefabs.Effects.Hit.HitCheng.prefab";
                     break;
                 case OnHitEffectType.紫色:
                     path = "Assets.Prefabs.Effects.Hit.HitZi.prefab";
                     break;
                 case OnHitEffectType.红色:
                     path = "Assets.Prefabs.Effects.Hit.HitHong.prefab";
                     break;
             }
         }
         WWWResourceManager.Instance.Load(path, (asset) => 
         {
             if (asset != null)
             {
                 theHitEffect = asset.Instantiate();
                 this.theHitEffect.transform.SetParent(entity.bindNodeTable[CommonDefineBase.BindCenter] as Transform);
                 theHitEffect.transform.localPosition = Vector3.zero;
                 DataEntityList data = DataEntityList.dataMap[entity.type];
                 AudioType type = AudioType.纹身男死亡;
                 switch (data.Name)
                 {
                     case "纹身男":
                         type = AudioType.纹身男死亡;
                         break;
                     case "胖子男":
                         type = AudioType.胖子男死亡;
                         break;
                 }
                 //播放音效
                 AudioManagerBase.Instance.LogicPlaySoundByClip(entity.audioSource, ResourcePoolManager.singleton.GetAudioClip(type));
             }
         });
         if (entity is EntityMonster)
         {
             entity.timer.Add(TimerManager.AddTimer(500, 0, () =>
             {
                 entity.Move();
             }));
         }
         else
         {
             entity.Idle();
         }
     }
 }