essence minigame improvements
This commit is contained in:
parent
f0649da5d3
commit
851b7ae0da
|
@ -31,7 +31,7 @@ Transform:
|
||||||
m_GameObject: {fileID: 3467985268477833302}
|
m_GameObject: {fileID: 3467985268477833302}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -5.04, y: 1.396, z: -11.537}
|
m_LocalPosition: {x: -5.04, y: 1.396, z: -11.537}
|
||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
|
||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 1
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
|
@ -203,6 +203,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
chime: {fileID: 965315076614651339}
|
chime: {fileID: 965315076614651339}
|
||||||
|
isTouched: 0
|
||||||
--- !u!82 &965315076614651339
|
--- !u!82 &965315076614651339
|
||||||
AudioSource:
|
AudioSource:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -7,15 +7,49 @@ public class EssenceNodeController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private AudioSource chime;
|
private AudioSource chime;
|
||||||
|
|
||||||
|
|
||||||
|
public bool isTouched;
|
||||||
|
private bool followPlayer = false;
|
||||||
|
private Transform player;
|
||||||
|
|
||||||
public void Touched()
|
public void Touched()
|
||||||
{
|
{
|
||||||
GetComponent<Renderer>().material.color = Color.cyan;
|
if (!isTouched)
|
||||||
chime.Play();
|
{
|
||||||
|
GetComponent<Renderer>().material.color = Color.cyan;
|
||||||
|
chime.Play();
|
||||||
|
isTouched = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FollowPlayer()
|
||||||
|
{
|
||||||
|
followPlayer = true;
|
||||||
|
player = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
||||||
|
StartCoroutine(Despawn());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPitch(float value)
|
public void SetPitch(float value)
|
||||||
{
|
{
|
||||||
chime.pitch = value;
|
chime.pitch = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IEnumerator Despawn()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(2f);
|
||||||
|
//TODO: Update value in player inventory
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (followPlayer)
|
||||||
|
{
|
||||||
|
transform.position = Vector3.Lerp(transform.position, new Vector3(player.position.x,player.position.y - 0.5f, player.position.z), Time.deltaTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,17 @@ public class WellController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject node;
|
public GameObject node;
|
||||||
public int numberOfNodes = 5;
|
public int numberOfNodes = 5;
|
||||||
|
private List<GameObject> nodes = new List<GameObject>();
|
||||||
|
|
||||||
|
public float spawnDelay;
|
||||||
|
//public float despawnTime;
|
||||||
|
|
||||||
|
|
||||||
private Transform player;
|
private Transform player;
|
||||||
|
|
||||||
|
public float rightDistance = 0.2f; //Distance between spawned nodes
|
||||||
|
public float maxUp = 0.2f; //Maximum up shift between orbs
|
||||||
|
public float minDown = -0.2f; //Same but for down
|
||||||
private Vector3 right;
|
private Vector3 right;
|
||||||
private Vector3 up;
|
private Vector3 up;
|
||||||
|
|
||||||
|
@ -24,22 +32,40 @@ public class WellController : MonoBehaviour
|
||||||
nodeSpawn.y = player.transform.position.y;
|
nodeSpawn.y = player.transform.position.y;
|
||||||
up = player.transform.up;
|
up = player.transform.up;
|
||||||
right = player.transform.right;
|
right = player.transform.right;
|
||||||
StartCoroutine(SpawnNode(nodeSpawn, 0));
|
StartCoroutine(SpawnNode(nodeSpawn, 0.5f, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator SpawnNode(Vector3 nodeSpawn, int i)
|
IEnumerator SpawnNode(Vector3 nodeSpawn, float pitch, int i)
|
||||||
{
|
{
|
||||||
if(i == numberOfNodes) yield break;
|
if(i == numberOfNodes)
|
||||||
|
{
|
||||||
|
foreach(GameObject node in nodes)
|
||||||
|
{
|
||||||
|
node.GetComponent<EssenceNodeController>().FollowPlayer();
|
||||||
|
}
|
||||||
|
nodes.Clear();
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
GameObject tempNode = Instantiate(node, nodeSpawn, Quaternion.identity);
|
GameObject tempNode = Instantiate(node, nodeSpawn, Quaternion.identity);
|
||||||
tempNode.GetComponent<AudioSource>().pitch += (i * (1f / numberOfNodes));
|
tempNode.GetComponent<AudioSource>().pitch = pitch;
|
||||||
nodeSpawn = nodeSpawn + right * 0.2f + Random.Range(-0.2f, 0.2f) * up;
|
nodeSpawn = nodeSpawn + right * rightDistance + Random.Range(minDown, maxUp) * up;
|
||||||
yield return new WaitForSeconds(2f);
|
yield return new WaitForSeconds(spawnDelay);
|
||||||
StartCoroutine(SpawnNode(nodeSpawn, i+1));
|
if (tempNode.GetComponent<EssenceNodeController>().isTouched)
|
||||||
|
{
|
||||||
|
nodes.Add(tempNode);
|
||||||
|
StartCoroutine(SpawnNode(nodeSpawn, pitch + 0.1f, i + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(tempNode);
|
||||||
|
StartCoroutine(SpawnNode(nodeSpawn, pitch, i + 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
transform.Rotate(0.5f, 0.5f, 0.5f);
|
transform.Rotate(new Vector3(10f, 10f, 10f) * Time.deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,10 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
node: {fileID: 3467985268477833302, guid: 1e00d72d45b494a4ea598ff34d46a589, type: 3}
|
node: {fileID: 3467985268477833302, guid: 1e00d72d45b494a4ea598ff34d46a589, type: 3}
|
||||||
numberOfNodes: 5
|
numberOfNodes: 5
|
||||||
|
spawnDelay: 1
|
||||||
|
rightDistance: 0.1
|
||||||
|
maxUp: 0.2
|
||||||
|
minDown: -0.2
|
||||||
--- !u!114 &175686037 stripped
|
--- !u!114 &175686037 stripped
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_CorrespondingSourceObject: {fileID: 7543052554150911968, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
m_CorrespondingSourceObject: {fileID: 7543052554150911968, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
|
@ -321,27 +325,27 @@ PrefabInstance:
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -12.049
|
value: -11.236
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0
|
value: 0.6532815
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0.38268343
|
value: -0.27059805
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0.92387956
|
value: -0.6532815
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: 0.27059805
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
@ -351,7 +355,7 @@ PrefabInstance:
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
value: 180
|
value: -90
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
- target: {fileID: 7543052554475355072, guid: 8f5582064724dbc45bc5c3432899f9c1,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|
|
@ -155,6 +155,8 @@ PlayerSettings:
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
|
|
Loading…
Reference in New Issue