From 2ee831b878a47d22292e0c02daa911ca21e89b1e Mon Sep 17 00:00:00 2001 From: RosimInc Date: Sun, 23 Aug 2015 13:53:36 -0400 Subject: [PATCH] Began the pillow swinging action Signed-off-by: RosimInc --- Assets/Scripts/Child.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Child.cs b/Assets/Scripts/Child.cs index 011e5f6..ac72a43 100644 --- a/Assets/Scripts/Child.cs +++ b/Assets/Scripts/Child.cs @@ -223,7 +223,23 @@ public class Child : MonoBehaviour pillow = null; } - } + } + + public void Swing() + { + //1. Determine if there is someone in front + Transform t = null; //GetTarget + + if(t == null) + return; + + //2. Apply force to the person + Vector3 direction = target.transform.position - transform.position; + + direction = direction.normalized; + + t.gameObject.GetComponent().Push(direction * ThrowForce); + } void OnCollisionEnter(Collision collision)