Esempio n. 1
0
        public PickObjectData(GameObject gameObject)
        {
            this.gameObject = gameObject;

            defaultLayer = gameObject.layer; // запоминаем настройки слоя объекта

                if(gameObject.GetComponent<BoxCollider>())
                    collider = EColliderType.BoxCollider;
                if (gameObject.GetComponent<SphereCollider>())
                    collider = EColliderType.SphereCollider;
                if (gameObject.GetComponent<CapsuleCollider>())
                    collider = EColliderType.CapsuleCollider;
                if (gameObject.GetComponent<WheelCollider>())
                    collider = EColliderType.WheelCollider;
                if (gameObject.GetComponent<MeshCollider>())
                    collider = EColliderType.MeshCollider;

            if (collider == EColliderType.None) { // нас интерисует только меш-коллидер

                gameObject.AddComponent<MeshCollider>();

            } else {

                if (collider==EColliderType.MeshCollider) return;

                MonoBehaviour.DestroyImmediate(gameObject.GetComponent<Collider>());
                gameObject.AddComponent<MeshCollider>();

            }
        }
Esempio n. 2
0
        private void SetCollider(Transform pTransformTarget, BoxCollider pBoxCollider)
        {
            p_pTransformTarget = pTransformTarget;

            _pBoxCollider_Current         = pBoxCollider;
            _pBoxCollider_Current.enabled = p_bColliderOn;

            _eColliderType = EColliderType.BoxCollider;
            _OnGetHit      = GetHit3D_BoxCollider;
        }
Esempio n. 3
0
        private void SetCollider(Transform pTransformTarget, SphereCollider pSphereCollider)
        {
            p_pTransformTarget = pTransformTarget;

            _pSphereCollider_Current         = pSphereCollider;
            _pSphereCollider_Current.enabled = p_bColliderOn;

            _eColliderType = EColliderType.SphereCollider;
            _OnGetHit      = GetHit3D_SphereCollider;
        }
Esempio n. 4
0
        private void SetCollider(Transform pTransformTarget, CircleCollider2D pCircleCollider2D)
        {
            p_pTransformTarget = pTransformTarget;

            _pCircleCollider2D_Current         = pCircleCollider2D;
            _pCircleCollider2D_Current.enabled = p_bColliderOn;

            _eColliderType = EColliderType.CircleCollider_2D;
            _OnGetHit      = GetHit2D_CircleCollider;
        }
    private void SetCollider(Transform pTransformTarget, BoxCollider2D pBoxCollider2D)
    {
        p_pTransformTarget = pTransformTarget;

        _pBoxCollider2D_Current         = pBoxCollider2D;
        _pBoxCollider2D_Current.enabled = false;

        _eColliderType = EColliderType.BoxCollider_2D;
        _OnGetHit      = GetHit2D_BoxCollider;
    }
Esempio n. 6
0
 protected virtual void OnValidate()
 {
     if (bIsTrigger)
     {
         if (ColliderType == EColliderType.PHYSICS)
         {
             ColliderType = EColliderType.MOVEABLE;
             Debug.LogWarning("A trigger collider cannot be a physics type collider. To save on calculations, please set the collider to static if it is to be a stationary trigger");
         }
     }
 }
Esempio n. 7
0
 public Collider(uint id, EColliderType type, float vertex1x, float vertex1y, float vertex2x, float vertex2y, float vertex3x, float vertex3y, float vertex4x, float vertex4y)
 {
     Id       = id;
     Type     = type;
     Vertex1x = vertex1x;
     Vertex1y = vertex1y;
     Vertex2x = vertex2x;
     Vertex2y = vertex2y;
     Vertex3x = vertex3x;
     Vertex3y = vertex3y;
     Vertex4x = vertex4x;
     Vertex4y = vertex4y;
 }
Esempio n. 8
0
        public void DoInit()
        {
            p_pTransformTarget = transform;
            _eColliderType     = EColliderType.None;
            DoRevertOriginTarget();

            _bIs2D = _eColliderType > EColliderType.Greater_Is2D;
            if (_bIs2D)
            {
                _arrCollider2D = new Collider2D[p_iHitInfoCount];
            }
            else
            {
                _arrCollider3D = new Collider[p_iHitInfoCount];
            }
        }
Esempio n. 9
0
    protected override void OnAwake()
    {
        base.OnAwake();

        _eColliderType = EColliderType.None;
        DoRevertOriginTarget();

        _bIs2D = _eColliderType > EColliderType.GreaterIs2D;
        if (_bIs2D)
        {
            _arrCollider2D = new Collider2D[p_iHitInfoCount];
        }
        else
        {
            _arrCollider3D = new Collider[p_iHitInfoCount];
        }
    }
Esempio n. 10
0
        public RopeNode()
        {
            goNode        = null;
            fLength       = 5.0f;
            fTotalLength  = fLength;
            nNumLinks     = 20;
            nTotalLinks   = nNumLinks;
            eColliderType = EColliderType.Capsule;
            nColliderSkip = 1;
            bFold         = true;
            bIsCoil       = false;

            bInitialOrientationInitialized = false;

            linkJoints               = new ConfigurableJoint[0];
            linkJointBreaksProcessed = new bool[0];
            bSegmentBroken           = false;
        }
Esempio n. 11
0
 public void SetBalltreeAsset(CRBalltreeAsset btAsset)
 {
     colliderType_ = EColliderType.BalltreeAsset;
     btAsset_      = btAsset;
 }
Esempio n. 12
0
 public void SetCustomColliderMesh(Mesh colliderMesh)
 {
     colliderType_ = EColliderType.CustomMesh;
     colliderMesh_ = colliderMesh;
 }