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 UnityEngine; | |
using System.Collections; | |
//How to Use: Attach this script to Controller(left) and/or Controller(right) to enable object pickup and throwing. | |
//Controller(left/right) need trigger collider components. Objects you want to interact with need the "Throwable" tag. | |
[RequireComponent(typeof(Collider))] | |
[RequireComponent(typeof(Rigidbody))] | |
public class GrabThrowFromHands : MonoBehaviour { | |
private SteamVR_TrackedObject trackedObj; |
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 Cannon : MonoBehaviour { | |
public GameObject projectile; //attach the projectile prefab here | |
public GameObject spawnpoint; //empty gameObject at position projectile should spawn | |
public float forceSpeed = 15f; | |
//SteamVR 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Projectile : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
Destroy(gameObject, 11f); | |
} |
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 UnityEngine; | |
using System.Collections; | |
using UnityEngine.SceneManagement; | |
[RequireComponent(typeof(SteamVR_LoadLevel))] | |
public class GameManager : MonoBehaviour { | |
public int score; | |
public int projectilesThrown; | |
public bool countNumberOfProjsThrown = true; | |
public int projectilesPerLevel = 5; |
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 UnityEngine; | |
using System.Collections; | |
public class BallReset : MonoBehaviour { | |
private Transform myTransform; | |
private Rigidbody myRigidbody; | |
private Vector3 startPosition; | |
public float resetYHeight = 0f; | |
public GameManager gameManager; |
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 UnityEngine; | |
using System.Collections; | |
public class Goal : MonoBehaviour { | |
public int scoreMultiplier = 1; | |
void OnTriggerEnter(Collider col) | |
{ | |
if (col.CompareTag("projectile")) |
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 UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
public class ScoreBoard : MonoBehaviour { | |
public GameManager gameManager; | |
private Text scoreText; | |
// Use this for initialization | |
void Start () { |
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.Video; | |
using UnityEngine.UI; | |
public class PlayMovieOnSpace : MonoBehaviour { |
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.UI; | |
public class ChangeText : MonoBehaviour { | |
public Text mytext; | |
private int counter; | |
// Use this for initialization | |
void Start () { |
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 UnityEngine; | |
using System.Collections; | |
public class PlayParticle: MonoBehaviour { | |
public ParticleSystem myEffect; | |
void OnTriggerEnter(Collider col) | |
{ | |
if (col.CompareTag("projectile")) |