void LogGestures(BaseGesture[] gestures, long frameKey) { StringBuilder logLine = new StringBuilder(); logLine.AppendFormat("Gestures frame: {0}, contains {1} gestures\n", frameKey, gestures.Length); int gestureCounter = 0; foreach (BaseGesture gesture in gestures) { string additionalGestureData = ""; // Update messages for gesture switch (gesture.Type) { case BaseGesture.GestureType.HEAD_POSITION: { HeadPositionGesture headPositionGesture = gesture as HeadPositionGesture; additionalGestureData = " (" + headPositionGesture.RegionIndex+")"; break; } case BaseGesture.GestureType.WINGS: { WingsGesture wingsGesture = gesture as WingsGesture; additionalGestureData = " (" + wingsGesture.ArmsAngle + ")"; break; } default: break; } logLine.AppendFormat("{0}. Gesture id: {1} - {2}{3}\n",gestureCounter, gesture.ID , gesture.Description, additionalGestureData); gestureCounter++; } Debug.Log(logLine); }
public void SetCountDown(DateTime time, BaseGesture gesture) { endTime = time.Add(DateTime.Now.TimeOfDay); totalMilliseconds = (float)time.TimeOfDay.TotalMilliseconds; this.gesture = gesture; timeSet = true; }
public void SetMarkerActive(DateTime time, BaseGesture gesture, GestureStates state) { SetColor(handSpriteRenderer, state); SetAlpha(handSpriteRenderer, alphaActive); spriteCollider.SetGesture(gesture); handSpritePrefab.GetComponent <BoxCollider>().enabled = true; countDown.SetCountDown(time, gesture); }
public Marker AddMarker(BaseGesture gesture, float indicatorVelocityMS) { var markerModel = GameObject.Instantiate(markerPrefab, gesturePlanePrefab.transform, false); var marker = markerModel.GetComponentInChildren <Marker>(); marker.Init(gesture, maxIndicatorPosition, minIndicatorPosition, indicatorVelocityMS, markerCount, markerTopPosition, markerSwapRange, this); markerCount++; return(marker); }
/// <summary> /// Used to emit gesture events. If you want to use gestures register you gesture implementation with /// </summary> /// <param name="gesture">Gesture.</param> public void EmitGesture(BaseGesture gesture) { if(gesture.IsDead) { if(GestureEnd != null) GestureEnd(gesture); }else { if(GestureStart != null) GestureStart(gesture); } }
public void Init(BaseGesture gesture, float maxX, float minX, float velocity, int count, int markerTopPosition, int swapRange, ViewManager viewManager) { float position = 0f; float offset = 0f; this.viewManager = viewManager; calc = new Calc(maxX, minX, velocity); gameObject.SetActive(true); gameObject.name = gesture.ToString(); offset = this.GetOffset(); position = calc.GetXByTime(gesture.StartPosition + offset); this.SetOrientation(calc.IsLeft); this.SetMarkerPreReady(GestureStates.PreReady); this.SetGestureSprite(gesture.GestureType); gameObject.transform.localPosition = new Vector3(position, markerTopPosition + count % swapRange, 0); }
public void SetGesture(BaseGesture gesture) { this.gesture = gesture; }