This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour { | |
private static T instance; | |
public static T Instance { | |
get { | |
//Check if instance already exists | |
if (instance == null){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FixedUpdate () | |
{ | |
float X_Rotation = Input.GetAxis("Mouse X"); | |
float Y_Rotation = Input.GetAxis("Mouse Y"); | |
Camera.main.transform.Rotate(0, -X_Rotation, 0); | |
Camera.main.transform.Rotate(Y_Rotation, 0, 0); | |
Ray ray = new Ray (Camera.main.transform.position, Camera.main.transform.forward); | |
Debug.DrawRay(ray.origin, ray.direction * 30f, Color.red); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Mole : MonoBehaviour { | |
[SerializeField] private float visibleHeight = 0.1f; | |
[SerializeField] private float hiddenHeight = -0.5f; | |
[SerializeField] private float speed = 4f; | |
[SerializeField] private float disappearDuration = 1.25f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Mole : MonoBehaviour { | |
[SerializeField] private float delta = 0.01f; | |
[SerializeField] private float checkY = 1; | |
[SerializeField] private float startY = -1; | |
[SerializeField] private float timeDelta = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using HoloToolkit.Unity.InputModule; | |
using HoloToolkit.Unity.SpatialMapping; | |
public class TapAndAddWindow : MonoBehaviour, IInputClickHandler | |
{ | |
[SerializeField] | |
GameObject prefab; | |
[SerializeField] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FixedUpdate () | |
{ | |
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); | |
mousePos.y = 0.0f; | |
transform.position = mousePos; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class TouchMove : MonoBehaviour { | |
[SerializeField] private GameObject cube; | |
[SerializeField]private float speed = 2.0f; | |
// Update is called once per frame | |
void Update () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Player : MonoBehaviour { | |
[SerializeField] private float moveSpeed = 2.0f; | |
[SerializeField] private float moveAngleX = 20.0f; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void OnInputClicked(InputClickedEventData eventData) | |
{ | |
Vector3 headPosition = Camera.main.transform.position; | |
Vector3 gazeDirection = Camera.main.transform.forward; | |
RaycastHit hitInfo; | |
if (Physics.Raycast(headPosition, gazeDirection, out hitInfo, 30.0f, spatialMappingManager.LayerMask)) | |
{ | |
Instantiate(target, GazeManager.Instance.HitPosition, Quaternion.FromToRotation(Vector3.up, hitInfo.normal)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update () | |
{ | |
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target.position - transform.position), 0.3f); | |
transform.position += transform.forward * 0.1f; | |
} |