From 17974bed9b26cb9223b24a4f4d2351f59f1a023f Mon Sep 17 00:00:00 2001 From: jparent Date: Sat, 22 Aug 2015 16:55:31 -0400 Subject: [PATCH] add basic pillow script --- Assets/Scripts/Pillow.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Pillow.cs b/Assets/Scripts/Pillow.cs index 61084a4..22c8f03 100644 --- a/Assets/Scripts/Pillow.cs +++ b/Assets/Scripts/Pillow.cs @@ -2,6 +2,8 @@ using System.Collections; public class Pillow : MonoBehaviour { + + public bool IsThrown = false; // Use this for initialization void Start () { @@ -10,7 +12,20 @@ public class Pillow : MonoBehaviour { // Update is called once per frame 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().takeHit(); + + Destroy(this.gameObject); + } + } + }