コード例 #1
0
        public void Process(EntityParent theOwner, params object[] args)
        {
            int act = (int)ActionConstants.die;

            theOwner.ApplyRootMotion(true);
            string actName = theOwner.CurrActStateName();//当前动画的名称

            if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hit_air]) || actName.EndsWith("getup"))
            {
                act = (int)ActionConstants.die_knock_down;
                theOwner.SetAction(act);
            }
            else if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hited_ground]) || actName.EndsWith("knockout"))
            {
                act = (int)ActionConstants.die;
                theOwner.SetAction(act);
            }
            else
            {
            }
            theOwner.SetSpeed(0);
            EventDispatch.TriggerEvent(Event.LogicSoundEvent.OnHitYelling, theOwner as EntityParent, act);
            if (theOwner is EntityMyself && theOwner.motor)
            {
                theOwner.motor.enableStick = false;
            }
        }
コード例 #2
0
 /// <summary>
 /// 播放主角音效
 /// </summary>
 /// <param name="source"></param>
 /// <param name="soundID"></param>
 public void MyselfLogicPlaySound(AudioSource source, int soundID)
 {
     if (avatarAudioClipBuffer.ContainsKey(soundID))                                                                                              //如果已经加载过,包含这个主角音效,直接播放
     {
         EventDispatch.TriggerEvent <AudioSource, AudioClip>(Event.LogicSoundEvent.LogicPlaySoundByClip, source, avatarAudioClipBuffer[soundID]); //通过事件驱动触发播放委托
         return;
     }
     if (!SoundData.dataMap.ContainsKey(soundID))
     {
         Debug.Log("音效ID" + soundID + "不存在!");
         return;
     }
     ResourceManager.singleton.LoadAudio(SoundData.dataMap[soundID].path, new AssetRequestFinishedEventHandler((assetRequest) =>
     {
         Object clip = assetRequest.AssetResource.MainAsset;
         UnityEngine.Object.DontDestroyOnLoad(clip);
         if (clip is AudioClip)
         {
             EventDispatch.TriggerEvent <AudioSource, AudioClip>(Event.LogicSoundEvent.LogicPlaySoundByClip, source, clip as AudioClip);
             if (!avatarAudioClipBuffer.ContainsKey(soundID))
             {
                 avatarAudioClipBuffer.Add(soundID, clip as AudioClip);
             }
         }
     }), AssetPRI.DownloadPRI_Low);
 }
コード例 #3
0
ファイル: test.cs プロジェクト: bianchengxiaobei/BeastGame
    void Start()
    {
        ResourceManager.singleton.Init(this.GetComponent("GameResourceManager") as IResourceManager);
        GameWorld.Init();
        RoleAttachedInfo info = new RoleAttachedInfo();

        EventDispatch.TriggerEvent <RoleAttachedInfo>(Game.Event.FrameWorkEvent.EntityAttached, info);
    }
コード例 #4
0
 public virtual void TriggerUniqEvent <T, U, V, W>(string eventType, T arg1, U arg2, V arg3, W arg4)
 {
     EventDispatch.TriggerEvent <T, U, V, W>(MakeUniqMessage(eventType), arg1, arg2, arg3, arg4);
 }
コード例 #5
0
 public virtual void TriggerUniqEvent <T, U>(string eventType, T arg1, U arg2)
 {
     EventDispatch.TriggerEvent <T, U>(MakeUniqMessage(eventType), arg1, arg2);
 }
コード例 #6
0
 virtual public void TriggerUniqEvent(string eventType)
 {
     EventDispatch.TriggerEvent(MakeUniqMessage(eventType));
 }