Example #1
0
        //解除实体
        public override void OnDetached(EntityLogicBase childEntity, object userData)
        {
            base.OnDetached(childEntity, userData);

            if (childEntity.GetType() == typeof(Thruster))    //推进器
            {
                m_Thruster = null;
                return;
            }

            if (childEntity.GetType() == typeof(Weapon))  //武器
            {
                m_ListWeapon.Remove(childEntity as Weapon);
                return;
            }

            if (childEntity.GetType() == typeof(Armor))   //装甲
            {
                m_ListArmor.Remove(childEntity as Armor);
                return;
            }
        }
Example #2
0
        //附加实体的回调
        public override void OnAttached(EntityLogicBase childEntity, Transform parentTransform, object userData)
        {
            base.OnAttached(childEntity, parentTransform, userData);

            if (childEntity.GetType() == typeof(Thruster))    //附加推进器
            {
                m_Thruster = childEntity as Thruster;
                return;
            }

            if (childEntity.GetType() == typeof(Weapon))      //附加武器
            {
                m_ListWeapon.Add(childEntity as Weapon);
                return;
            }

            if (childEntity.GetType() == typeof(Armor))       //附加装甲
            {
                m_ListArmor.Add(childEntity as Armor);
                return;
            }
        }