add basic Pillow and pickup when in proximity

This commit is contained in:
jparent 2015-08-22 01:05:40 -04:00
parent aa52b3439d
commit a4aa35f554
5 changed files with 51 additions and 0 deletions

BIN
Assets/Scenes/jp.unity Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c46fa10dab418474cbf869f61d972336
timeCreated: 1440215783
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,12 +7,27 @@ public class Child : MonoBehaviour
public float Speed = 10f;
private Rigidbody _rb;
public Pillow pillow;
void Awake()
{
_rb = GetComponent<Rigidbody>();
}
void OnTriggerEnter(Collider other) {
if (other.tag == "Pillow") {
pillow = other.GetComponent<Pillow>();
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

16
Assets/Scripts/Pillow.cs Normal file
View File

@ -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 () {
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e000b2f669ba4344490c42914fbad190
timeCreated: 1440216742
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: