Exemple #1
0
 public void RemoveAttachedObject(int objectId, bool isDestroy = false)
 {
     GfxSystem.DetachGameObject(objectId);
     if (isDestroy)
     {
         GfxSystem.DestroyGameObject(objectId);
     }
 }
Exemple #2
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);
            }
        }
Exemple #3
0
 protected void DestroyActor()
 {
     if (0 != m_GunActor)
     {
         GfxSystem.DetachGameObject(m_GunActor);
         GfxSystem.DestroyGameObject(m_GunActor);
     }
     GfxSystem.DestroyGameObject(m_Actor);
     Release();
 }
Exemple #4
0
 public void Destroy()
 {
     GfxSystem.DestroyGameObject(m_Actor);
 }