void RequestPoolEnlargement(PreferredColliderType cType) { GameObject go = new GameObject("collider_pooled_" + cType.ToString()); switch (cType) { case PreferredColliderType.BOX_COLLIDER: go.AddComponent <BoxCollider>(); PooledColliderInfo pInfo_b = new PooledColliderInfo(PreferredColliderType.BOX_COLLIDER, go); boxPool.Add(pInfo_b); break; case PreferredColliderType.SPHERE_COLLIDER: go.AddComponent <SphereCollider>(); PooledColliderInfo pInfo_s = new PooledColliderInfo(PreferredColliderType.SPHERE_COLLIDER, go); spherePool.Add(pInfo_s); break; case PreferredColliderType.CAPSULE_COLLIDER: go.AddComponent <CapsuleCollider>(); PooledColliderInfo pInfo_c = new PooledColliderInfo(PreferredColliderType.CAPSULE_COLLIDER, go); capsulePool.Add(pInfo_c); break; } }
public BakedColliderInfo(Transform _colliderT, PreferredColliderType _colliderType) { position = _colliderT.position; rotation = _colliderT.rotation; extents = _colliderT.GetComponent <Renderer>().bounds; colliderType = _colliderType; }
public PooledColliderInfo(PreferredColliderType _colliderType, GameObject _go) { colliderType = _colliderType; go = _go; c = _go.GetComponent <Collider>(); }