手势插件引入暂存
This commit is contained in:
1 parent
6d1bc8e2c8
commit
fd8f419f09
70 files changed
+5062
-126
No files matched your search
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bb37a37b01b54cf0824218be7f4b5db
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,226 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
public class DemoOne : MonoBehaviour
|
||||
{
|
||||
public Transform cube;
|
||||
private Vector2 _scrollPosition; // for the scroll view
|
||||
public AnimationCurve touchPadInputCurve = AnimationCurve.Linear( 0.0f, 0.0f, 1.0f, 1.0f );
|
||||
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
GUI.skin.button.padding = new RectOffset( 10, 10, 20, 20 );
|
||||
GUI.skin.button.fixedWidth = 250;
|
||||
|
||||
|
||||
GUILayout.BeginArea( new Rect( Screen.width - GUI.skin.button.fixedWidth - 20, 0, GUI.skin.button.fixedWidth + 20, Screen.height ) );
|
||||
_scrollPosition = GUILayout.BeginScrollView( _scrollPosition, GUILayout.Width( GUI.skin.button.fixedWidth + 20 ), GUILayout.Height( Screen.height ) );
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Tap Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKTapRecognizer();
|
||||
|
||||
// we can limit recognition to a specific Rect, in this case the bottom-left corner of the screen
|
||||
recognizer.boundaryFrame = new TKRect( 0, 0, 50f, 50f );
|
||||
|
||||
// we can also set the number of touches required for the gesture
|
||||
if( Application.platform == RuntimePlatform.IPhonePlayer )
|
||||
recognizer.numberOfTouchesRequired = 2;
|
||||
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "tap recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Long Press Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKLongPressRecognizer();
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "long press recognizer fired: " + r );
|
||||
};
|
||||
recognizer.gestureCompleteEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "long press recognizer finished: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Pan Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKPanRecognizer();
|
||||
|
||||
// when using in conjunction with a pinch or rotation recognizer setting the min touches to 2 smoothes movement greatly
|
||||
if( Application.platform == RuntimePlatform.IPhonePlayer )
|
||||
recognizer.minimumNumberOfTouches = 2;
|
||||
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
Camera.main.transform.position -= new Vector3( recognizer.deltaTranslation.x, recognizer.deltaTranslation.y ) / 100;
|
||||
Debug.Log( "pan recognizer fired: " + r );
|
||||
};
|
||||
|
||||
// continuous gestures have a complete event so that we know when they are done recognizing
|
||||
recognizer.gestureCompleteEvent += r =>
|
||||
{
|
||||
Debug.Log( "pan gesture complete" );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add TouchPad Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKTouchPadRecognizer( new TKRect( 0f, 50f, 80f, 50f ) );
|
||||
recognizer.inputCurve = touchPadInputCurve;
|
||||
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
//Camera.main.transform.position -= new Vector3( recognizer.deltaTranslation.x, recognizer.deltaTranslation.y ) / 100;
|
||||
Debug.Log( "touchpad recognizer fired: " + r );
|
||||
};
|
||||
|
||||
// continuous gestures have a complete event so that we know when they are done recognizing
|
||||
recognizer.gestureCompleteEvent += r =>
|
||||
{
|
||||
Debug.Log( "touchpad gesture complete" );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Horizontal Swipe Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKSwipeRecognizer();
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "swipe recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
if( GUILayout.Button( "Add Top-Right Swipe Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKAngleSwipeRecognizer();
|
||||
recognizer.addAngleRecogizedEvents (
|
||||
(TKAngleSwipeRecognizer r) => {
|
||||
Debug.Log( "Top-Right angle swipe fired " + r );
|
||||
}, new Vector2(1,1), 45);
|
||||
|
||||
recognizer.gestureRecognizedEvent += r => {
|
||||
// You can also do ordinary event, which fires at any angle
|
||||
// Debug.Log( "angle swipe recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Pinch Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKPinchRecognizer();
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
cube.transform.localScale += Vector3.one * recognizer.deltaScale;
|
||||
Debug.Log( "pinch recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Rotation Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKRotationRecognizer();
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
cube.Rotate( Vector3.back, recognizer.deltaRotation );
|
||||
Debug.Log( "rotation recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Button Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKButtonRecognizer( new TKRect( 5f, 145f, 80f, 30f ), 10f );
|
||||
recognizer.zIndex = 1;
|
||||
recognizer.onSelectedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "button recognizer selected: " + r );
|
||||
};
|
||||
recognizer.onDeselectedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "button recognizer deselected: " + r );
|
||||
};
|
||||
recognizer.onTouchUpInsideEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "button recognizer touch up inside: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add One Finger Rotation Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKOneFingerRotationRecognizer();
|
||||
recognizer.targetPosition = Camera.main.WorldToScreenPoint( cube.position );
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
cube.Rotate( Vector3.back, recognizer.deltaRotation );
|
||||
Debug.Log( "one finger rotation recognizer fired: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Any Touch Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKAnyTouchRecognizer( new TKRect( 10, 10, 80, 50 ) );
|
||||
recognizer.zIndex = 1;
|
||||
recognizer.onEnteredEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "any touch entered: " + r );
|
||||
};
|
||||
recognizer.onExitedEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "any touch exited: " + r );
|
||||
};
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Add Curve Recognizer" ) )
|
||||
{
|
||||
var recognizer = new TKCurveRecognizer();
|
||||
|
||||
recognizer.gestureRecognizedEvent += ( r ) =>
|
||||
{
|
||||
cube.Rotate( Vector3.back, recognizer.deltaRotation );
|
||||
Debug.Log( "curve recognizer fired: " + r );
|
||||
};
|
||||
|
||||
recognizer.gestureCompleteEvent += ( r ) =>
|
||||
{
|
||||
Debug.Log( "curve completed.");
|
||||
};
|
||||
|
||||
TouchKit.addGestureRecognizer( recognizer );
|
||||
}
|
||||
|
||||
|
||||
if( GUILayout.Button( "Remove All Recognizers" ) )
|
||||
{
|
||||
TouchKit.removeAllGestureRecognizers();
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndArea();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f2caec28268145de81952dd10b76252
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,612 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 1
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 512
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &20608213
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 20608214}
|
||||
- component: {fileID: 20608215}
|
||||
- component: {fileID: 20608218}
|
||||
- component: {fileID: 20608216}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &20608214
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 20608213}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!20 &20608215
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 20608213}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 100
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!81 &20608216
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 20608213}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &20608218
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 20608213}
|
||||
m_Enabled: 1
|
||||
--- !u!1 &235682970
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 235682974}
|
||||
- component: {fileID: 235682973}
|
||||
- component: {fileID: 235682972}
|
||||
- component: {fileID: 235682971}
|
||||
m_Layer: 0
|
||||
m_Name: Sphere
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!23 &235682971
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 235682970}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!135 &235682972
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 235682970}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &235682973
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 235682970}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &235682974
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 235682970}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.183403, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1052943443}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &764707309
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 764707311}
|
||||
- component: {fileID: 764707310}
|
||||
m_Layer: 0
|
||||
m_Name: TouchKit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &764707310
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 764707309}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e065ffc7dbca743ee9cef1b5106b0d26, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
simulateTouches: 1
|
||||
simulateMultitouch: 1
|
||||
drawTouches: 1
|
||||
drawDebugBoundaryFrames: 1
|
||||
autoScaleRectsAndDistances: 1
|
||||
shouldAutoUpdateTouches: 1
|
||||
maxTouchesToProcess: 2
|
||||
--- !u!4 &764707311
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 764707309}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1052943442
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1052943443}
|
||||
- component: {fileID: 1052943445}
|
||||
- component: {fileID: 1052943446}
|
||||
- component: {fileID: 1052943444}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1052943443
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1052943442}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.036293983, y: 1, z: -4.0702114}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 235682974}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1052943444
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1052943442}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &1052943445
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1052943442}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!65 &1052943446
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1052943442}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1332715272
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1332715273}
|
||||
- component: {fileID: 1332715274}
|
||||
m_Layer: 0
|
||||
m_Name: ui
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1332715273
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1332715272}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -354.3353, y: 172.3465, z: 49.999996}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1332715274
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1332715272}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8f2caec28268145de81952dd10b76252, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
cube: {fileID: 1052943443}
|
||||
touchPadInputCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0.14999999
|
||||
value: 0
|
||||
inSlope: 0.4453594
|
||||
outSlope: 0.4453594
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 2.7624688
|
||||
outSlope: 2.7624688
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &1591823659
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1591823660}
|
||||
- component: {fileID: 1591823661}
|
||||
m_Layer: 0
|
||||
m_Name: Directional light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1591823660
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1591823659}
|
||||
m_LocalRotation: {x: 0.27440774, y: 0.06740036, z: -0.045521457, w: 0.95816773}
|
||||
m_LocalPosition: {x: 0, y: 9.506577, z: -27.999771}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!108 &1591823661
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1591823659}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 0
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f1b907393c7e41448148dc6517f5c3d
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bedd8b8197a974a16b124fd890c0e775
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// this demo will create a virtual d-pad and two buttons. the virtual d-pad will have a left, right and up button. the up
|
||||
/// button will overlap the left and right buttons. the reason for this is to show one way to handle 5 directional d-pad
|
||||
/// (left, up-left, up, up-right, right) letting the player slide their finger around. It alsow demonstrates how the TKAnyTouchRecognizer
|
||||
/// does not "eat" touches and allows them to bleed down through to recognizers below them.
|
||||
///
|
||||
/// note that we are working with a 16:9 design time resolution since that is the most popular on mobile and a good base. Note also
|
||||
/// that we have set shouldAutoUpdateTouches to false and we are manually calling updateTouches. This lets us process the touches
|
||||
/// exactly when we want: right before we use them.
|
||||
/// </summary>
|
||||
public class DemoTwo : MonoBehaviour
|
||||
{
|
||||
private VirtualControls _controls;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
_controls = new VirtualControls();
|
||||
_controls.createDebugQuads();
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
_controls.update();
|
||||
}
|
||||
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
showLabelAndValue( "Left: ", _controls.leftDown.ToString() );
|
||||
showLabelAndValue( "Right: ", _controls.rightDown.ToString() );
|
||||
showLabelAndValue( "Up: ", _controls.upDown.ToString() );
|
||||
|
||||
GUILayout.Space( 4 );
|
||||
|
||||
showLabelAndValue( "Attack: ", _controls.attackDown.ToString() );
|
||||
showLabelAndValue( "Jump: ", _controls.jumpDown.ToString() );
|
||||
}
|
||||
|
||||
|
||||
void showLabelAndValue( string label, string value )
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label( label, GUILayout.Width( 50 ) );
|
||||
GUILayout.Label( value );
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14e83b1078b824cc5957fa7a77be02d7
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,308 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 1
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 512
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &59454456
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 59454461}
|
||||
- component: {fileID: 59454460}
|
||||
- component: {fileID: 59454458}
|
||||
- component: {fileID: 59454457}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &59454457
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 59454456}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &59454458
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 59454456}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &59454460
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 59454456}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &59454461
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 59454456}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &494578000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 494578002}
|
||||
- component: {fileID: 494578001}
|
||||
m_Layer: 0
|
||||
m_Name: DemoTwo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &494578001
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 494578000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 14e83b1078b824cc5957fa7a77be02d7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &494578002
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 494578000}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1995668659
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1995668661}
|
||||
- component: {fileID: 1995668660}
|
||||
m_Layer: 0
|
||||
m_Name: TouchKit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1995668660
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1995668659}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e065ffc7dbca743ee9cef1b5106b0d26, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
simulateTouches: 1
|
||||
simulateMultitouch: 1
|
||||
drawTouches: 1
|
||||
drawDebugBoundaryFrames: 1
|
||||
autoScaleRectsAndDistances: 1
|
||||
shouldAutoUpdateTouches: 0
|
||||
maxTouchesToProcess: 5
|
||||
--- !u!4 &1995668661
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1995668659}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62c8bf4ea5f784fed9707bbb086970ae
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,126 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// this class shows one way to setup a virtual control setup (d-pad and two buttons). It illustrates a bunch of concepts
|
||||
/// including recognizer layering (overlapping "up" button to get diagonals) and also how to detect only in this frame
|
||||
/// if a button is down (attack button).
|
||||
/// </summary>
|
||||
public class VirtualControls
|
||||
{
|
||||
public bool leftDown, upDown, rightDown, attackDown, jumpDown;
|
||||
|
||||
private float buttonWidth = 24f;
|
||||
private float buttonHeight = 30f;
|
||||
|
||||
|
||||
private TKAnyTouchRecognizer _leftRecognizer;
|
||||
private TKAnyTouchRecognizer _rightRecognizer;
|
||||
private TKAnyTouchRecognizer _upRecognizer;
|
||||
|
||||
private TKButtonRecognizer _attackRecognizer;
|
||||
private TKButtonRecognizer _jumpRecognizer;
|
||||
|
||||
public TKRect leftRect { get { return _leftRecognizer.boundaryFrame.Value; } }
|
||||
public TKRect rightRect { get { return _rightRecognizer.boundaryFrame.Value; } }
|
||||
public TKRect upRect { get { return _upRecognizer.boundaryFrame.Value; } }
|
||||
|
||||
public TKRect attackRect { get { return _attackRecognizer.boundaryFrame.Value; } }
|
||||
public TKRect jumpRect { get { return _jumpRecognizer.boundaryFrame.Value; } }
|
||||
|
||||
|
||||
public VirtualControls()
|
||||
{
|
||||
// if we have something like the iPad with a squarish aspect ratio adjust the button height to be a bit smaller
|
||||
if( Camera.main.aspect < 1.7f )
|
||||
{
|
||||
buttonHeight *= Camera.main.aspect / 1.7f;
|
||||
buttonWidth *= Camera.main.aspect / 1.7f;
|
||||
}
|
||||
setupRecognizers();
|
||||
}
|
||||
|
||||
|
||||
public void update()
|
||||
{
|
||||
// reset our state
|
||||
leftDown = upDown = rightDown = attackDown = jumpDown = false;
|
||||
|
||||
// first update our touches then use our recognizers to set our state
|
||||
TouchKit.updateTouches();
|
||||
|
||||
leftDown = _leftRecognizer.state == TKGestureRecognizerState.RecognizedAndStillRecognizing;
|
||||
rightDown = _rightRecognizer.state == TKGestureRecognizerState.RecognizedAndStillRecognizing;
|
||||
upDown = _upRecognizer.state == TKGestureRecognizerState.RecognizedAndStillRecognizing;
|
||||
|
||||
jumpDown = _jumpRecognizer.state == TKGestureRecognizerState.RecognizedAndStillRecognizing;
|
||||
}
|
||||
|
||||
|
||||
public void createDebugQuads()
|
||||
{
|
||||
createQuadButton( leftRect, Color.green );
|
||||
createQuadButton( rightRect, Color.green );
|
||||
createQuadButton( upRect, Color.white );
|
||||
|
||||
createQuadButton( attackRect, Color.cyan );
|
||||
createQuadButton( jumpRect, Color.magenta );
|
||||
}
|
||||
|
||||
|
||||
void createQuadButton( TKRect rect, Color color )
|
||||
{
|
||||
color.a = 0.2f;
|
||||
|
||||
// find the center point in Unity units
|
||||
var center = Camera.main.ScreenToWorldPoint( rect.center );
|
||||
center.z = 0;
|
||||
|
||||
// create the quad button
|
||||
var button = GameObject.CreatePrimitive( PrimitiveType.Quad );
|
||||
button.transform.position = center;
|
||||
button.GetComponent<Renderer>().material.shader = Shader.Find( "Sprites/Default" );
|
||||
button.GetComponent<Renderer>().material.color = color;
|
||||
|
||||
// scale the quad button accordingly
|
||||
button.transform.localScale = new Vector3
|
||||
(
|
||||
TouchKit.instance.pixelsToUnityUnitsMultiplier.x * rect.width,
|
||||
TouchKit.instance.pixelsToUnityUnitsMultiplier.y * rect.height
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void setupRecognizers()
|
||||
{
|
||||
// left button
|
||||
_leftRecognizer = new TKAnyTouchRecognizer( new TKRect( 0f, 0f, buttonWidth, buttonHeight ) );
|
||||
TouchKit.addGestureRecognizer( _leftRecognizer );
|
||||
|
||||
|
||||
// right button
|
||||
_rightRecognizer = new TKAnyTouchRecognizer( new TKRect( buttonWidth + 1f, 0f, buttonWidth, buttonHeight ) );
|
||||
TouchKit.addGestureRecognizer( _rightRecognizer );
|
||||
|
||||
|
||||
// up button. we place it 70% of the way up the other two buttons allowing some overlap
|
||||
_upRecognizer = new TKAnyTouchRecognizer( new TKRect( 0f, buttonHeight * 0.7f, buttonWidth * 2f + 1f, 20f ) );
|
||||
TouchKit.addGestureRecognizer( _upRecognizer );
|
||||
|
||||
|
||||
// attack button. we use the onSelectedEvent here because we only want to know the exact frame it was pressed
|
||||
_attackRecognizer = new TKButtonRecognizer( new TKRect( TouchKit.instance.designTimeResolution.x - buttonWidth * 2f, 0, buttonWidth, buttonHeight ), 0f );
|
||||
_attackRecognizer.onSelectedEvent += ( r ) =>
|
||||
{
|
||||
attackDown = true;
|
||||
};
|
||||
TouchKit.addGestureRecognizer( _attackRecognizer );
|
||||
|
||||
|
||||
// jump button
|
||||
_jumpRecognizer = new TKButtonRecognizer( new TKRect( TouchKit.instance.designTimeResolution.x - buttonWidth, 0, buttonWidth, buttonHeight ), 0f );
|
||||
TouchKit.addGestureRecognizer( _jumpRecognizer );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dbccd6fa8ec6447aaa2b359982e10a0
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Reference in new issue
Block a user