Initial minigame testing in scene
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
public class EssenceNodeController : MonoBehaviour
|
||||
{
|
||||
public void Touched()
|
||||
{
|
||||
GetComponent<Renderer>().material.color = Color.cyan;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8d18c6d4425a674c921717bf08e59bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/Project Files/Scripts/JoonasP/WellController.cs
Normal file
39
Assets/Project Files/Scripts/JoonasP/WellController.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WellController : MonoBehaviour
|
||||
{
|
||||
public GameObject node;
|
||||
public int numberOfNodes = 5;
|
||||
|
||||
private Transform player;
|
||||
|
||||
private Vector3 right;
|
||||
private Vector3 up;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void StartMinigame()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
||||
Vector3 nodeSpawn = player.transform.position + (player.forward * 0.5f);
|
||||
nodeSpawn.y = player.transform.position.y;
|
||||
up = player.transform.up;
|
||||
right = player.transform.right;
|
||||
StartCoroutine(SpawnNode(nodeSpawn, 0));
|
||||
}
|
||||
|
||||
IEnumerator SpawnNode(Vector3 nodeSpawn, int i)
|
||||
{
|
||||
if(i == numberOfNodes) yield break;
|
||||
|
||||
Instantiate(node, nodeSpawn, Quaternion.identity);
|
||||
nodeSpawn = nodeSpawn + (right * 0.2f);
|
||||
yield return new WaitForSeconds(2f);
|
||||
StartCoroutine(SpawnNode(nodeSpawn, i+1));
|
||||
}
|
||||
}
|
||||
11
Assets/Project Files/Scripts/JoonasP/WellController.cs.meta
Normal file
11
Assets/Project Files/Scripts/JoonasP/WellController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 580a2bc767950d54d9fdf84752500d7f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user