mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-26 10:00:58 +00:00
add basic pillow script
This commit is contained in:
parent
d0e0286029
commit
17974bed9b
@ -3,6 +3,8 @@ using System.Collections;
|
|||||||
|
|
||||||
public class Pillow : MonoBehaviour {
|
public class Pillow : MonoBehaviour {
|
||||||
|
|
||||||
|
public bool IsThrown = false;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
|
||||||
@ -10,7 +12,20 @@ public class Pillow : MonoBehaviour {
|
|||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
|
if (transform.position.y < -10) {
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTriggerEnter(Collider other) {
|
||||||
|
if (IsThrown && other.tag == "Player") {
|
||||||
|
|
||||||
|
Debug.Log("A child got hit by a pillow!");
|
||||||
|
|
||||||
|
//other.GetComponent<Child>().takeHit();
|
||||||
|
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user