Skip to content

Instantly share code, notes, and snippets.

//click
if (TAB.TabContent.length != 0)
{
for (var i=0; i< TAB.TabContent.length; i++)
{
for (var j=0; j< TAB.TabContent[i].BeadsX.length; j++)
@dotKokott
dotKokott / InteractionClient.cs
Created May 8, 2013 14:51
example InteractionClient
class InteractionClient : IInteractionClient {
public InteractionInfo GetInteractionInfoAtLocation(int skeletonTrackingId, InteractionHandType handType, double x, double y) {
var info = new InteractionInfo();
info.IsGripTarget = true;
info.IsPressTarget = false;
info.PressAttractionPointX = 0f;
info.PressAttractionPointY = 0f;
info.PressTargetControlId = 0;
return info;
interactionStream = new InteractionStream(Sensor, new InteractionClient());
//..SNIP...
void ProcessDepthFrame() {
using (var dif = this.Sensor.DepthStream.OpenNextFrame(0)) {
if (dif != null) {
DepthImagePixel[] data = new DepthImagePixel[dif.PixelDataLength];
dif.CopyDepthImagePixelDataTo(data);
@dotKokott
dotKokott / Player.cs
Last active December 17, 2015 03:09
Determine if player is dragging or not
private InteractionHandPointer getHandPointer() {
UserInfo userInfo;
var hand = JointType.HandLeft;
if (UserInfos.TryGetValue(Player.Skeleton.TrackingId, out userInfo)) {
return (from InteractionHandPointer hp in userInfo.HandPointers where hp.HandType == hand select hp).FirstOrDefault();
}
return null;
}
@dotKokott
dotKokott / Singleton.cs
Created February 9, 2017 22:33
Makes any Unity monobehaviour a singleton that inherits from it
//FROM http://www.glenstevens.ca/unity3d-best-practices/
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
protected static T instance;
/**
Returns the instance of this singleton.
*/
public static T Instance
{
@dotKokott
dotKokott / CreateScriptableObjectX
Created February 9, 2017 22:52
Adds a menu item for creating scriptable objects
using UnityEngine;
using UnityEditor;
public class CreateScriptableObjectX {
[MenuItem( "Assets/Create/ScriptableObjectX" )]
public static void CreateAsset() {
ScriptableObjectUtility.CreateAsset<ScriptableObjectX>();
}
}