mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
Finished door easing and optimised shadow positioning
Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
parent
b89e7e1341
commit
a31eab5996
Binary file not shown.
41
Assets/Test/Door.cs
Normal file
41
Assets/Test/Door.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class Door : MonoBehaviour {
|
||||||
|
|
||||||
|
private float state = 0f; //From 0 to 1 (closed to open)
|
||||||
|
private float goal = -1f; //-1 or 1
|
||||||
|
public float angles;
|
||||||
|
public float openingSpeed;
|
||||||
|
public AnimationCurve curvature;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.A))
|
||||||
|
{
|
||||||
|
goal *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = Mathf.Clamp(state + goal * openingSpeed * Time.deltaTime, 0f, 1f);
|
||||||
|
|
||||||
|
//transform.rotation = Quaternion.identity;
|
||||||
|
//transform.Rotate(Vector3.up * state * angles);
|
||||||
|
transform.rotation = Quaternion.Euler(Vector3.up * curvature.Evaluate(state) * -angles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Open()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Test/Door.cs.meta
Normal file
12
Assets/Test/Door.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c921a0b390e23b64a94eb3e55d68e369
|
||||||
|
timeCreated: 1440269019
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 5.1.2f1
|
m_EditorVersion: 5.0.2f1
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user