예제 #1
0
    /// <summary>
    /// 创建角色
    /// </summary>
    /// <param name="index"></param>
    private void CreateActor(int index)
    {
        string bodyweaponstring = string.Empty;

        if (index >= 0 && index < mRoleData.Count)
        {
            // 获取配置的初始武器和装备信息
            //bodyweaponstring = GameConstHelper.GetString(string.Format("GAME_BORN_ROLE{0}", mRoleData[index].rid));

            string[]    splits    = bodyweaponstring.Split('[', ',', ']');
            List <uint> modelList = new List <uint>();
            if (splits.Length > 3)
            {
                uint bodyId = uint.Parse(splits[1]);
                modelList.Add(bodyId);
                uint weaponId = uint.Parse(splits[2]);
                modelList.Add(weaponId);
            }
            modelList = ActorManager.ReplaceModelList(modelList, (Actor.EVocationType)mRoleData[index].rid, false);

            UnitID actor_uid = null;
            if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetFashion() != 0)
            {
                //List<uint> npc_id = SDKHelper.GetRoleList();
                //actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(npc_id[index]), OnActorLoaded);


                uint        type_idx     = ActorHelper.RoleIdToTypeId(mRoleData[index].rid);
                List <uint> model_list   = new List <uint>();
                List <uint> fashion_list = new List <uint>();
                ActorHelper.GetModelFashionList(mRoleData[index].shows, model_list, fashion_list);
                fashion_list.Add(SDKHelper.GetFashion());
                var         model_id_list = ActorManager.ReplaceModelList(model_list, (Actor.EVocationType)mRoleData[index].rid, true);
                ClientModel actor         = ClientModel.CreateClientModel(type_idx, mRoleData[index].uuid, model_id_list, fashion_list, mRoleData[index].effects, OnActorLoaded);
                mActors.Add(actor);
            }
            else
            {
                actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(mRoleData[index].rid), OnActorLoaded);
            }



            var client_model = ActorManager.Instance.GetActor(actor_uid) as ClientModel;
            if (client_model != null)
            {
                client_model.AttackSpeed = 1.0f;// 攻速必须为1,不然出场特效与动作匹配不上
                mActors.Add(client_model);
            }
        }
    }
예제 #2
0
 /// <summary>
 /// 加载指引需要的角色模型
 /// </summary>
 public void PrepareModel(string ani_name)
 {
     m_AnimationName = ani_name;
     if (m_ModelId != null)
     {
         var actor = ActorManager.Instance.GetActor(m_ModelId);
         if (actor != null && string.IsNullOrEmpty(ani_name) == false)
         {
             actor.CrossFade(ani_name);
             float delay_time = actor.GetAnimationLength(m_AnimationName);
             MainGame.HeartBehavior.StartCoroutine(PlayIdle(actor, delay_time, "idle"));
         }
     }
     else
     {
         m_ModelId = ClientModel.CreateClientModelByActorIdForLua(GameConstHelper.GetUint("GAME_GUIDE_MODEL"), OnModelLoaded);
     }
 }