diff --git a/Assets/Scenes/jp.unity b/Assets/Scenes/jp.unity new file mode 100644 index 0000000..d987175 Binary files /dev/null and b/Assets/Scenes/jp.unity differ diff --git a/Assets/Scenes/jp.unity.meta b/Assets/Scenes/jp.unity.meta new file mode 100644 index 0000000..4326961 --- /dev/null +++ b/Assets/Scenes/jp.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c46fa10dab418474cbf869f61d972336 +timeCreated: 1440215783 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Child.cs b/Assets/Scripts/Child.cs index 9ff814d..56c1fea 100644 --- a/Assets/Scripts/Child.cs +++ b/Assets/Scripts/Child.cs @@ -7,12 +7,27 @@ public class Child : MonoBehaviour public float Speed = 10f; private Rigidbody _rb; + public Pillow pillow; + void Awake() { _rb = GetComponent(); } + + + void OnTriggerEnter(Collider other) { + if (other.tag == "Pillow") { + + pillow = other.GetComponent(); + other.transform.parent = transform; // make the pillow a child of Child + + // TODO: place the pillow correctly or animate or something... + + } + } + public void Move(float xValue, float zValue) { // We move the child depending on the camera orientation diff --git a/Assets/Scripts/Pillow.cs b/Assets/Scripts/Pillow.cs new file mode 100644 index 0000000..61084a4 --- /dev/null +++ b/Assets/Scripts/Pillow.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections; + +public class Pillow : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } + +} diff --git a/Assets/Scripts/Pillow.cs.meta b/Assets/Scripts/Pillow.cs.meta new file mode 100644 index 0000000..1a9ba40 --- /dev/null +++ b/Assets/Scripts/Pillow.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e000b2f669ba4344490c42914fbad190 +timeCreated: 1440216742 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: