Пример #1
0
 /// <summary>
 /// OnCollisionExit is called when this collider/rigidbody has
 /// stopped touching another rigidbody/collider.
 /// </summary>
 /// <param name="other">The Collision data associated with this collision.</param>
 void OnCollisionExit(Collision other)
 {
     GamePlay.Obstacle obstacle = other.collider.gameObject.GetComponentInChildren <Obstacle>();
     if (obstacle != null)
     {
         bullet.ResetLength();
         hitObstacle = null;
     }
 }
Пример #2
0
        /// <summary>
        /// OnCollisionStay is called once per frame for every collider/rigidbody
        /// that is touching rigidbody/collider.
        /// </summary>
        /// <param name="other">The Collision data associated with this collision.</param>
        void OnCollisionStay(Collision other)
        {
            MatrixCollider matrix = other.gameObject.GetComponentInChildren <MatrixCollider>();

            if (matrix != null)
            {
                bullet.HitMatrix(matrix.matrix);
                return;
            }
            GamePlay.Obstacle obstacle = other.collider.gameObject.GetComponentInChildren <Obstacle>();
            if (obstacle != null)
            {
                endPos = other.contacts[0].point;
                bullet.HitObstacle(obstacle);
                hitObstacle = obstacle;
            }
        }