mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-25 17:40:59 +00:00
add basic Pillow and pickup when in proximity
This commit is contained in:
parent
aa52b3439d
commit
a4aa35f554
BIN
Assets/Scenes/jp.unity
Normal file
BIN
Assets/Scenes/jp.unity
Normal file
Binary file not shown.
8
Assets/Scenes/jp.unity.meta
Normal file
8
Assets/Scenes/jp.unity.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c46fa10dab418474cbf869f61d972336
|
||||||
|
timeCreated: 1440215783
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -7,12 +7,27 @@ public class Child : MonoBehaviour
|
|||||||
public float Speed = 10f;
|
public float Speed = 10f;
|
||||||
|
|
||||||
private Rigidbody _rb;
|
private Rigidbody _rb;
|
||||||
|
public Pillow pillow;
|
||||||
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
_rb = GetComponent<Rigidbody>();
|
_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)
|
public void Move(float xValue, float zValue)
|
||||||
{
|
{
|
||||||
// We move the child depending on the camera orientation
|
// We move the child depending on the camera orientation
|
||||||
|
|||||||
16
Assets/Scripts/Pillow.cs
Normal file
16
Assets/Scripts/Pillow.cs
Normal 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 () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
Assets/Scripts/Pillow.cs.meta
Normal file
12
Assets/Scripts/Pillow.cs.meta
Normal 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:
|
||||||
Loading…
x
Reference in New Issue
Block a user