Example #1
0
        /// <summary>
        /// Make a pretty explosion on clients
        /// </summary>
        public void DestroyBullet(GameObject destoryObj, BulletClass explosionClass)
        {
            int            ClassIndex = (int)explosionClass;
            ExplosionCache pool       = m_ExplosionCache[ClassIndex];

            if (pool != null)
            {
                destoryObj.SetActive(false);
            }
            else
            {
                MonoBehaviour.Destroy(destoryObj);
            }
        }
Example #2
0
        /// <summary>
        /// 实例化子弹对象
        /// </summary>
        public GameObject CreateVisualBullet(Vector3 pos, Vector3 dir, float speed, BulletClass explosionClass)
        {
            GameObject     spawnedEffect = null;
            int            ClassIndex    = (int)explosionClass;
            ExplosionCache pool          = m_ExplosionCache[ClassIndex];

            switch (explosionClass)
            {
            case BulletClass.FiringExplosion:
                spawnedEffect = pool.NextGameObject();
                break;

            case BulletClass.ClusterExplosion:
                spawnedEffect = pool.NextGameObject();
                break;

            case BulletClass.PulseExplosion:
                spawnedEffect = pool.NextGameObject();
                break;
            }
            return(spawnedEffect);
        }