This file contains 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
private void UpdateFood(float dt, bool forceUpdate) | |
{ | |
this.m_foodUpdateTimer += dt; | |
if (this.m_foodUpdateTimer >= 1f || forceUpdate) | |
{ | |
this.m_foodUpdateTimer -= 1f; | |
foreach (Player.Food food in this.m_foods) | |
{ | |
food.m_time -= 1f; | |
float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime); |
This file contains 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 PokeRigidBody() | |
{ | |
//Make sure to import TouchScreenWrap.cs first | |
if (TouchScreenWrap.touches.Length > 0) | |
{ | |
var ray = cam.ScreenPointToRay(TouchScreenWrap.touches[0].position); | |
RaycastHit hit; | |
//Our finger poke on something with collider | |
if (Physics.Raycast(ray, out hit)) { | |
if (hit.transform.GetComponent<Rigidbody>() != null) |
This file contains 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; | |
using UnityEngine.XR.ARFoundation; | |
using UnityEngine.XR.ARSubsystems; | |
public class ARRaycasting : MonoBehaviour | |
{ | |
public GameObject cube; | |
[SerializeField] |
This file contains 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 Transform handTransform; | |
void Update() | |
{ | |
if (OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger)) | |
{ | |
//Do something when click the button on the VR controller | |
} | |
//Get thumbstick input |
This file contains 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
var ray = cam.ScreenPointToRay(TouchScreenWrap.touches[0].position); | |
RaycastHit hit; | |
if (Physics.Raycast(ray, out hit)) { | |
if (hit.transform.GetComponent<Rigidbody>() != null) | |
{ | |
Vector3 offSet = hit.transform.position - cam.transform.position; | |
hit.transform.GetComponent<Rigidbody>().AddForce(offSet.normalized * Force, ForceMode.VelocityChange); | |
} | |
} |
This file contains 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
namespace Tmp | |
{ | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System; | |
[Serializable] | |
public class mazeCube | |
{ |
This file contains 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 GameObject VP; | |
public GameObject Prefab; | |
public Transform hand; | |
GameObject theObj; | |
public float speed = 300.0f; | |
// Update is called once per frame | |
void Update() | |
{ | |
//For getting button(s) |
This file contains 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; | |
using System; | |
[Serializable] | |
public class mazeCube | |
{ | |
public int preFabType; | |
public Vector3 pos; |
This file contains 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() | |
{ | |
foreach (Touch _touch in TouchScreenInputWrapper.touches) | |
{ | |
if (_touch.phase == TouchPhase.Began) { | |
Ray ray = Camera.main.ScreenPointToRay(_touch.position); | |
//This can show the ray in the editor scene windows. | |
Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow, duration: 3); | |
RaycastHit hit; | |
Physics.Raycast(ray: ray, hitInfo: out hit, maxDistance: 100); |
This file contains 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 UpdatePlayerRespawnPoint : MonoBehaviour | |
{ | |
public Vector3 RespawnPoint; | |
private void OnTriggerEnter(Collider other) | |
{ | |
//if the enter object is the player |
NewerOlder