コード例 #1
0
    public void OnSyncEnemyAnimation(EnemyAnimationModel model)
    {
        foreach (EnemyAnimtionProperty property in model.list)
        {
            GameObject enemyGo;

            bool isGet = enemyDict.TryGetValue(property.guid, out enemyGo);
            if (isGet)
            {
                Animation anim = enemyGo.GetComponent <Animation>();
                if (property.isAttack)
                {
                    anim.Play("attack01");
                }
                if (property.isDie)
                {
                    anim.Play("die");
                }
                if (property.isIdle)
                {
                    anim.Play("idle");
                }
                if (property.isTakeDamage)
                {
                    anim.Play("takedamage");
                }
                if (property.isWalk)
                {
                    anim.Play("walk");
                }
            }
        }
    }
コード例 #2
0
    public void SyncEnemyAnimation(EnemyAnimationModel model)
    {
        Dictionary <byte, object> parameters = new Dictionary <byte, object>();

        ParameterTool.AddParmeter(parameters, ParameterCode.EnemyAnimationModel, model);
        PhotonEngine.Instance.SendRequest(OpCode, SubCode.SyncAnimation, parameters);
    }
コード例 #3
0
 private void OnSyncEnemyAnimation(EnemyAnimationModel model)
 {
     foreach (var property in model.list)
     {
         GameObject enemyGo = null;
         if (enemyDic.TryGetValue(property.guid, out enemyGo))
         {
             Animation anim = enemyGo.GetComponent <Animation>();
             if (property.isWalk)
             {
                 anim.Play("walk");
             }
             else if (property.isIdle)
             {
                 anim.Play("idle");
             }
             else if (property.isDie)
             {
                 anim.Play("die");
             }
             else if (property.isTakeDamage)
             {
                 anim.Play("takedamage");
             }
             else if (property.isAttack)
             {
                 anim.Play("attack01");
             }
         }
     }
 }
コード例 #4
0
    public override void OnEvent(EventData eventData)
    {
        SubCode subCode = ParameterTool.GetParameters <SubCode>(eventData.Parameters, ParameterCode.SubCode, false);

        switch (subCode)
        {
        case SubCode.CreateEnemy:
            //Debug.Log("Get the response from server..");
            CreateEnemyModel model = ParameterTool.GetParameters <CreateEnemyModel>(eventData.Parameters, ParameterCode.CreateEnemyModel);
            if (OnCreateEnemy != null)
            {
                OnCreateEnemy(model);
            }
            break;

        case SubCode.AsyncPostionAndEularAngler:
            EnemyPostionModel enemyPosmodel = ParameterTool.GetParameters <EnemyPostionModel>(eventData.Parameters, ParameterCode.EnemyPostionModel);
            if (OnAsyncEnemyPostionRotation != null)
            {
                OnAsyncEnemyPostionRotation(enemyPosmodel);
            }
            break;

        case SubCode.SyncEnemyAnimation:
            EnemyAnimationModel enemyAnimmodel = ParameterTool.GetParameters <EnemyAnimationModel>(eventData.Parameters, ParameterCode.EnemyAnimationModel);
            if (OnSyncEnemyAnimation != null)
            {
                OnSyncEnemyAnimation(enemyAnimmodel);
            }
            break;
        }
    }
コード例 #5
0
ファイル: EnemyController.cs プロジェクト: mengtest/ARPG-1
    public override void OnEvent(EventData eventData)
    {
        SubCode subcode = ParameterTool.GetSubcode(eventData.Parameters);

        switch (subcode)
        {
        case SubCode.CreateEnemy:
            CreateEnemyModel model = ParameterTool.GetParameter <CreateEnemyModel>(eventData.Parameters,
                                                                                   ParameterCode.CreateEnemyModel);
            if (OnCreateEnemy != null)
            {
                OnCreateEnemy(model);
            }
            break;

        case SubCode.SyncPositionAndRotation:
            EnemyPositionModel model1 = ParameterTool.GetParameter <EnemyPositionModel>(eventData.Parameters,
                                                                                        ParameterCode.EnemyPositionModel);
            if (OnSyncEnemyPositionAndRotation != null)
            {
                OnSyncEnemyPositionAndRotation(model1);
            }
            break;

        case SubCode.SyncAnimation:
            EnemyAnimationModel model2 = ParameterTool.GetParameter <EnemyAnimationModel>(eventData.Parameters,
                                                                                          ParameterCode.EnemyAnimationModel);
            if (OnSyncEnemyAnimation != null)
            {
                OnSyncEnemyAnimation(model2);
            }
            break;
        }
    }
コード例 #6
0
 void SyncEnemyAnimation()
 {
     if (enemyAnimationToSyncList != null || enemyAnimationToSyncList.Count > 0)
     {
         EnemyAnimationModel model = new EnemyAnimationModel();
         foreach (Enemy enemy in enemyAnimationToSyncList)
         {
             EnemyAnimationProperty property = new EnemyAnimationProperty()
             {
                 guid         = enemy.guid,
                 isAttack     = enemy.animation.IsPlaying("attack01"),
                 isDie        = enemy.animation.IsPlaying("die"),
                 isIdle       = enemy.animation.IsPlaying("idle"),
                 isTakeDamage = enemy.animation.IsPlaying("takedamage"),
                 isWalk       = enemy.animation.IsPlaying("walk")
             };
             model.list.Add(property);
         }
         enemyController.SyncEnemyAnimation(model);
         enemyAnimationToSyncList.Clear();
     }
 }
コード例 #7
0
 //用来发起敌人动画同步的请求
 void SyncEnemyAnimation()
 {
     if (enemyToSyncAnimationList != null && enemyToSyncAnimationList.Count > 0)
     {
         EnemyAnimationModel model = new EnemyAnimationModel();
         foreach (Enemy enemy in enemyToSyncAnimationList)
         {
             Animation             anim     = enemy.GetComponent <Animation>();
             EnemyAnimtionProperty property = new EnemyAnimtionProperty()
             {
                 guid         = enemy.guid,
                 isAttack     = anim.IsPlaying("attack01"),
                 isDie        = anim.IsPlaying("die"),
                 isTakeDamage = anim.IsPlaying("takedamage"),
                 isIdle       = anim.IsPlaying("idle"),
                 isWalk       = anim.IsPlaying("walk"),
             };
             model.list.Add(property);
         }
         enemyController.SyncEnemyAnimation(model);
         enemyToSyncAnimationList.Clear();
     }
 }
コード例 #8
0
ファイル: EnemyController.cs プロジェクト: vin120/TaiDou
 //同步敌人动画
 public void SyncEnemyAnimation(EnemyAnimationModel model)
 {
     Dictionary<byte, object> parameters = new Dictionary<byte, object>();
     ParameterTool.AddParameter(parameters, ParameterCode.EnemyAnimationModel, model);
     PhotonEngine.Instance.SendRequest(OpCode, SubCode.SyncAnimation, parameters);  
 }
コード例 #9
0
ファイル: TranscriptManager.cs プロジェクト: vin120/TaiDou
 private void OnSyncEnemyAnimation(EnemyAnimationModel model)
 {
     foreach (EnemyAnimationProperty property in model.list)
     {
         GameObject enemyGo;
         bool isGet = enemyDict.TryGetValue(property.guid, out enemyGo);
         if (isGet)
         {
             Animation anim = enemyGo.GetComponent<Animation>();
             if (property.isIdle)
             {
                 anim.Play("idle");
             }
             if (property.isAttack)
             {
                 anim.Play("attack01");
             }
             if (property.isDie)
             {
                 anim.Play("die");
             }
             if (property.isTakeDamage)
             {
                 anim.Play("takedamage");
             }
             if (property.isWalk)
             {
                 anim.Play("walk");
             }
         }
     }
 }
コード例 #10
0
ファイル: TranscriptManager.cs プロジェクト: vin120/TaiDou
 //发起同步敌人动画同步的请求
 void SyncEnemyAnimation()
 {
     if (enemyToSyncAnimationList != null && enemyToSyncAnimationList.Count > 0)
     {
         EnemyAnimationModel model = new EnemyAnimationModel();
         foreach (Enemy enemy in enemyToSyncAnimationList)
         {
             Animation anim = enemy.GetComponent<Animation>();
             EnemyAnimationProperty property = new EnemyAnimationProperty()
             {
                 guid= enemy.guid,
                 isAttack    = anim.IsPlaying("attack01"),
                 isDie       = anim.IsPlaying("die"),
                 isIdle      = anim.IsPlaying("idle"),
                 isTakeDamage= anim.IsPlaying("takedamage"),
                 isWalk      = anim.IsPlaying("walk")
             };
             model.list.Add(property);
         }
         enemyController.SyncEnemyAnimation(model);
         enemyToSyncAnimationList.Clear();
     }
 }