コード例 #1
0
    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;
        }
    }
コード例 #2
0
    public BakedColliderInfo(Transform _colliderT, PreferredColliderType _colliderType)
    {
        position = _colliderT.position;
        rotation = _colliderT.rotation;
        extents  = _colliderT.GetComponent <Renderer>().bounds;

        colliderType = _colliderType;
    }
コード例 #3
0
 public PooledColliderInfo(PreferredColliderType _colliderType, GameObject _go)
 {
     colliderType = _colliderType;
     go           = _go;
     c            = _go.GetComponent <Collider>();
 }