t1 / TFDContents / Assets / KinectDemos / PhysicsDemo / Scripts / BarrelTrigger.cs @ 3
이력 | 보기 | 이력해설 | 다운로드 (392 Bytes)
| 1 | 3 | KTH | using UnityEngine; |
|---|---|---|---|
| 2 | using System.Collections; |
||
| 3 | |||
| 4 | public class BarrelTrigger : MonoBehaviour |
||
| 5 | {
|
||
| 6 | [Tooltip("Reference to the BallController-component to be invoked, when the barrel gets hit by a ball.")]
|
||
| 7 | public BallController ballController; |
||
| 8 | |||
| 9 | |||
| 10 | void OnTriggerEnter(Collider col) |
||
| 11 | {
|
||
| 12 | if (col.tag == "Player") |
||
| 13 | {
|
||
| 14 | if (ballController) |
||
| 15 | {
|
||
| 16 | ballController.BarrelWasHit(); |
||
| 17 | } |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | } |