Skip to content

Instantly share code, notes, and snippets.

View sam-keene's full-sized avatar

Sam Keene sam-keene

View GitHub Profile
@sam-keene
sam-keene / SDKBoyTeleportController.cs
Created April 7, 2017 04:32
Part of a Medium tutorial on building a multiplayer game in Daydream VR and Unity
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class TeleportEvent : UnityEvent<Vector3>
{
}
public class SDKBoyTeleportController : MonoBehaviour {
@sam-keene
sam-keene / PlayerController.cs
Created April 7, 2017 04:30
Part of a Medium tutorial on building a multiplayer game in Daydream VR and Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public GameObject gvrControllerPointer;
public GameObject head;
public GameObject otherPlayersController;
public GameObject playerCamera;
@sam-keene
sam-keene / PhotonCommsManager.cs
Created April 7, 2017 04:29
Part of a Medium tutorial on building a multiplayer game in Daydream VR and Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon;
public class PhotonCommsManager : Photon.PunBehaviour {
private GameObject currentPlayer;
@sam-keene
sam-keene / NetworkPlayer.cs
Created April 7, 2017 04:27
Part of a Medium tutorial on building a multiplayer game in Daydream VR and Unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetworkPlayer : Photon.MonoBehaviour {
public GameObject otherPlayerController;
public GameObject playerController;
public GameObject otherPlayerHead;
public Camera playerCamera;
@sam-keene
sam-keene / Unity EventManager Using UnityEvents With Parameters
Last active December 18, 2021 23:34
Unity EventManager using UnityEvents and a HashTable to pass data of any type as a parameter in the event.
using UnityEngine.Events;
using System.Collections;
using System.Collections.Generic;
/*
Unity C# Event manager using UnityEvents and a Hashtable for loosely typed params with event.
This EventManager expands the usefulness of UnityEvents by allowing values of any type to be passed as a
parameter in the Event eg: int, string, Vector3 etc.
Usage:
@sam-keene
sam-keene / Daydream VR Teleportation
Last active March 20, 2017 05:04
Daydream VR: Example of extracting the Raycast Hit Data directly from the GvrLaserPointer for teleporting using the GvrPointerManager, bypassing the EventSystem pattern of GvrPointerInputModule and the hit object's TriggerEvent.
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour {
void Update () {
if (GvrController.ClickButtonUp) {
GvrLaserPointerImpl laserPointerImpl = (GvrLaserPointerImpl)GvrPointerManager.Pointer;
if (laserPointerImpl.IsPointerIntersecting) {
gameObject.transform.position = new Vector3(laserPointerImpl.PointerIntersection.x, gameObject.transform.position.y, laserPointerImpl.PointerIntersection.z);