Ejemplo n.º 1
0
        public void UpdateWeaponModel(CharacterInfo entity)
        {
            if (null == entity)
            {
                return;
            }
            if (null == entity.GetShootStateInfo().GetAllWeapon())
            {
                //LogSystem.Debug("--weapon: no weapon!");
                return;
            }

            if (0 != m_GunActor)
            {
                GfxSystem.DetachGameObject(m_GunActor);
                GfxSystem.DestroyGameObject(m_GunActor);
            }

            List <WeaponInfo> weapons = entity.GetShootStateInfo().GetAllWeapon();

            if (null == weapons || weapons.Count == 0)
            {
                //LogSystem.Debug("---weapon attach: no weapon!");
                return;
            }
            foreach (WeaponInfo weapon in weapons)
            {
                string   weaponResName = weapon.ResourceName;
                string[] wrn_peer      = weaponResName.Split(new string[] { "|", "," }, StringSplitOptions.None);
                if (wrn_peer.Length < 2)
                {
                    continue;
                }
                string wrnResName  = wrn_peer[0];
                string wrnSkeleton = wrn_peer[1];
                bool   ret         = false;
                for (int j = 0; j < CurWeaponList.Count; ++j)
                {
                    if (CurWeaponList[j].Equals(wrnResName))
                    {
                        ret = true;
                    }
                }
                if (ret)
                {
                    //LogSystem.Debug("---weapon change: weapon is same");
                    return;
                }
                GetCurActionConfig();
                CurWeaponList.Add(wrnResName);
                m_GunActor = GameObjectIdManager.Instance.GenNextId();
                GfxSystem.CreateGameObjectForAttach(m_GunActor, wrnResName);
                GfxSystem.AttachGameObject(m_GunActor, m_Actor, wrnSkeleton);
                GfxSystem.SetGameObjectVisible(m_GunActor, true);

                LogSystem.Debug("User {0} Weapon {1} Res {2} Bind {3}", m_Actor, m_GunActor, wrnResName, wrnSkeleton);
            }
        }
Ejemplo n.º 2
0
        private void Release()
        {
            List <string> keyList = effect_map_.Keys.ToList();

            if (keyList != null && keyList.Count > 0)
            {
                foreach (string model in keyList)
                {
                    //DetachActor(model);
                }
            }
            CurWeaponList.Clear();
        }