/// <summary> /// OnCollisionEnter is called when this collider/rigidbody has begun /// touching another rigidbody/collider. /// </summary> /// <param name="other">The Collision data associated with this collision.</param> void OnCollisionEnter(Collision other) { MatrixCollider matrix = other.gameObject.GetComponentInChildren <MatrixCollider>(); if (matrix != null) { bullet.HitMatrix(matrix.matrix); return; } }
/// <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; } }
void OnCollisionEnter(Collision other) { GamePlayerData gamePlayerData = other.gameObject.GetComponent <GamePlayerData>(); if (gamePlayerData != null) { gamePlayerData. gamePlayer. rayLine. GetDamageFromBullet( bullet ); return; } // Debug.Log(other.gameObject.name); MatrixCollider matrixCollider = other.gameObject.GetComponentInChildren <MatrixCollider>(); if (matrixCollider != null) { matrixCollider.matrix.Hitted(this.bullet); } }