/*--------------------------------------------------------------------------------*/ public MeshMapping(IndicatorGrid _indicatorGrid) { indicatorGrid = _indicatorGrid; cursor = Character2D.mappings[(int)Character2D.Mood.NEUTRAL]; triangleMesh = new TriangleMesh2D(Character2D.map, Character2D.mappings); bounding = new Bounding2D( Character2D.mappings[(int)Character2D.Mood.SAD], Character2D.mappings[(int)Character2D.Mood.RELAXED], Character2D.mappings[(int)Character2D.Mood.EXCITED], Character2D.mappings[(int)Character2D.Mood.IRRITATED] ); cursor = bounding.Clip(cursor); indicatorGrid.SetCursor(bounding.GetMappedCoordinates(-1.0f, 1.0f)); }
/*--------------------------------------------------------------------------------*/ public void MoveCursor(Vector2 movement) { Vector3 newPos = cursor + movement; int triangleIndex = triangleMesh.IsInside(newPos); if (triangleIndex > -1) { float[] ratios = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; GetKeyShapeRatios(triangleIndex, newPos, ref ratios); characterCtrl.SetMoodInterPolated(ratios); cursor = newPos; } cursor = bounding.Clip(newPos); indicatorGrid.SetCursor(bounding.GetMappedCoordinates(-1.0f, 1.0f)); }