Skip to content

Instantly share code, notes, and snippets.

@rondagdag
Created February 24, 2016 21:41
Show Gist options
  • Save rondagdag/94260118a8d0b3e862d0 to your computer and use it in GitHub Desktop.
Save rondagdag/94260118a8d0b3e862d0 to your computer and use it in GitHub Desktop.
This is how I set the move type to be sent to web app in raspberry pi
using UnityEngine;
using System.Collections;
using CrazyMinnow.SALSA; // Import SALSA from the CrazyMinnow namespace
/*
Script usage instructions
This class demonstrates the use of the RandomEyes 2D/3D [Broadcast Eye Events],
and the RandomEyes 3D [Broadcast Custom Shape Events], to catch
RandomEyes_OnLookStatusChanged and RandomEyes_OnCustomShapeChanged events.
1. Create a GameObject and attach this script to it.
2. Set this GameObject as a [Broadcast Receiver] in RandomEyes.
*/
namespace CrazyMinnow.SALSA.Examples
{
public class CM_RandomEyesBroadcastEventTester : MonoBehaviour
{
CylonCoroutine cylonCoroutine;
void Start()
{
cylonCoroutine = (CylonCoroutine)FindObjectOfType(typeof(CylonCoroutine));
}
void RandomEyes_OnLookStatusChanged(RandomEyesLookStatus status)
{
/*Debug.Log("RandomEyes_OnLookStatusChanged:" +
" instance(" + status.instance.GetType() + ")," +
" name(" + status.instance.name + ")," +
" lookPosition(" + status.lookPosition + ")," +
" blendSpeed(" + status.blendSpeed + ")," +
" rangeOfMotion(" + status.rangeOfMotion + ")");*/
string moveType = string.Empty;
switch (status.lookPosition) {
case RandomEyesLook.Position.Left:
moveType = "look_left";
break;
case RandomEyesLook.Position.Right:
moveType = "look_right";
break;
case RandomEyesLook.Position.Up:
moveType = "look_up";
break;
case RandomEyesLook.Position.Down:
moveType = "look_down";
break;
}
cylonCoroutine.MoveType = moveType;
}
void RandomEyes_OnCustomShapeChanged(RandomEyesCustomShapeStatus status)
{
Debug.Log("RandomEyes_OnCustomShapeChanged:" +
" instance(" + status.instance.GetType() + ")," +
" name(" + status.instance.name + ")," +
" shapeIndex(" + status.shapeIndex + ")," +
" shapeName(" + status.shapeName + ")," +
" overrideOn(" + status.overrideOn + ")," +
" isOn(" + status.isOn + ")," +
" blendSpeed(" + status.blendSpeed + ")," +
" rangeOfMotion(" + status.rangeOfMotion + ")");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment