Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
|
3b4006e240 | 11 months ago |
|
e245b778e7 | 11 months ago |
|
cfe0b3de0f | 11 months ago |
|
8674182eed | 11 months ago |
|
fed3f7e621 | 11 months ago |
|
11bf8ee29e | 11 months ago |
|
abbbbc6967 | 11 months ago |
|
d1e653c997 | 11 months ago |
|
398e9fd04b | 11 months ago |
|
b308241a3f | 11 months ago |
|
da2dace272 | 11 months ago |
|
bc0f59f028 | 11 months ago |
|
09b42d587a | 12 months ago |
|
9a5789dd04 | 12 months ago |
|
6066f52411 | 12 months ago |
|
edc492738b | 12 months ago |
|
3f4b766f5d | 12 months ago |
|
c9786484cc | 12 months ago |
|
4e5594db26 | 12 months ago |
|
72d03050d9 | 12 months ago |
|
de5d65ee8f | 12 months ago |
|
aea0a18a29 | 12 months ago |
|
732253e7e0 | 12 months ago |
|
f95e9551b0 | 12 months ago |
|
1a8ab65f51 | 12 months ago |
|
c04142207d | 12 months ago |
|
9f9b12d8d4 | 12 months ago |
|
33794f2362 | 12 months ago |
|
1e00716034 | 12 months ago |
|
1301da8e15 | 12 months ago |
171 changed files with 18401 additions and 4517 deletions
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,97 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a4e7020e0586a674394242237d1bdd4d |
||||||
|
ModelImporter: |
||||||
|
serializedVersion: 19301 |
||||||
|
internalIDToNameTable: [] |
||||||
|
externalObjects: {} |
||||||
|
materials: |
||||||
|
materialImportMode: 1 |
||||||
|
materialName: 0 |
||||||
|
materialSearch: 1 |
||||||
|
materialLocation: 1 |
||||||
|
animations: |
||||||
|
legacyGenerateAnimations: 4 |
||||||
|
bakeSimulation: 0 |
||||||
|
resampleCurves: 1 |
||||||
|
optimizeGameObjects: 0 |
||||||
|
motionNodeName: |
||||||
|
rigImportErrors: |
||||||
|
rigImportWarnings: |
||||||
|
animationImportErrors: |
||||||
|
animationImportWarnings: |
||||||
|
animationRetargetingWarnings: |
||||||
|
animationDoRetargetingWarnings: 0 |
||||||
|
importAnimatedCustomProperties: 0 |
||||||
|
importConstraints: 0 |
||||||
|
animationCompression: 1 |
||||||
|
animationRotationError: 0.5 |
||||||
|
animationPositionError: 0.5 |
||||||
|
animationScaleError: 0.5 |
||||||
|
animationWrapMode: 0 |
||||||
|
extraExposedTransformPaths: [] |
||||||
|
extraUserProperties: [] |
||||||
|
clipAnimations: [] |
||||||
|
isReadable: 0 |
||||||
|
meshes: |
||||||
|
lODScreenPercentages: [] |
||||||
|
globalScale: 1 |
||||||
|
meshCompression: 0 |
||||||
|
addColliders: 0 |
||||||
|
useSRGBMaterialColor: 1 |
||||||
|
sortHierarchyByName: 1 |
||||||
|
importVisibility: 1 |
||||||
|
importBlendShapes: 1 |
||||||
|
importCameras: 1 |
||||||
|
importLights: 1 |
||||||
|
fileIdsGeneration: 2 |
||||||
|
swapUVChannels: 0 |
||||||
|
generateSecondaryUV: 0 |
||||||
|
useFileUnits: 1 |
||||||
|
keepQuads: 0 |
||||||
|
weldVertices: 1 |
||||||
|
preserveHierarchy: 0 |
||||||
|
skinWeightsMode: 0 |
||||||
|
maxBonesPerVertex: 4 |
||||||
|
minBoneWeight: 0.001 |
||||||
|
meshOptimizationFlags: -1 |
||||||
|
indexFormat: 0 |
||||||
|
secondaryUVAngleDistortion: 8 |
||||||
|
secondaryUVAreaDistortion: 15.000001 |
||||||
|
secondaryUVHardAngle: 88 |
||||||
|
secondaryUVPackMargin: 4 |
||||||
|
useFileScale: 1 |
||||||
|
tangentSpace: |
||||||
|
normalSmoothAngle: 60 |
||||||
|
normalImportMode: 0 |
||||||
|
tangentImportMode: 3 |
||||||
|
normalCalculationMode: 4 |
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 |
||||||
|
blendShapeNormalImportMode: 1 |
||||||
|
normalSmoothingSource: 0 |
||||||
|
referencedClips: [] |
||||||
|
importAnimation: 1 |
||||||
|
humanDescription: |
||||||
|
serializedVersion: 3 |
||||||
|
human: [] |
||||||
|
skeleton: [] |
||||||
|
armTwist: 0.5 |
||||||
|
foreArmTwist: 0.5 |
||||||
|
upperLegTwist: 0.5 |
||||||
|
legTwist: 0.5 |
||||||
|
armStretch: 0.05 |
||||||
|
legStretch: 0.05 |
||||||
|
feetSpacing: 0 |
||||||
|
globalScale: 1 |
||||||
|
rootMotionBoneName: |
||||||
|
hasTranslationDoF: 0 |
||||||
|
hasExtraRoot: 0 |
||||||
|
skeletonHasParents: 1 |
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0} |
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1 |
||||||
|
animationType: 2 |
||||||
|
humanoidOversampling: 1 |
||||||
|
avatarSetup: 0 |
||||||
|
additionalBone: 0 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,77 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!21 &2100000 |
||||||
|
Material: |
||||||
|
serializedVersion: 6 |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_Name: XFGX |
||||||
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} |
||||||
|
m_ShaderKeywords: |
||||||
|
m_LightmapFlags: 4 |
||||||
|
m_EnableInstancingVariants: 0 |
||||||
|
m_DoubleSidedGI: 0 |
||||||
|
m_CustomRenderQueue: -1 |
||||||
|
stringTagMap: {} |
||||||
|
disabledShaderPasses: [] |
||||||
|
m_SavedProperties: |
||||||
|
serializedVersion: 3 |
||||||
|
m_TexEnvs: |
||||||
|
- _BumpMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailAlbedoMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailMask: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailNormalMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _EmissionMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _MainTex: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _MetallicGlossMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _OcclusionMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _ParallaxMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
m_Floats: |
||||||
|
- _BumpScale: 1 |
||||||
|
- _Cutoff: 0.5 |
||||||
|
- _DetailNormalMapScale: 1 |
||||||
|
- _DstBlend: 0 |
||||||
|
- _GlossMapScale: 1 |
||||||
|
- _Glossiness: 0 |
||||||
|
- _GlossyReflections: 1 |
||||||
|
- _Metallic: 0 |
||||||
|
- _Mode: 0 |
||||||
|
- _OcclusionStrength: 1 |
||||||
|
- _Parallax: 0.02 |
||||||
|
- _SmoothnessTextureChannel: 0 |
||||||
|
- _SpecularHighlights: 1 |
||||||
|
- _SrcBlend: 1 |
||||||
|
- _UVSec: 0 |
||||||
|
- _ZWrite: 1 |
||||||
|
m_Colors: |
||||||
|
- _Color: {r: 1, g: 0, b: 0, a: 1} |
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 164ae163aaa5da046a49318b4faa9614 |
||||||
|
NativeFormatImporter: |
||||||
|
externalObjects: {} |
||||||
|
mainObjectFileID: 2100000 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,78 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!21 &2100000 |
||||||
|
Material: |
||||||
|
serializedVersion: 6 |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_Name: New Material |
||||||
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} |
||||||
|
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON |
||||||
|
m_LightmapFlags: 4 |
||||||
|
m_EnableInstancingVariants: 0 |
||||||
|
m_DoubleSidedGI: 0 |
||||||
|
m_CustomRenderQueue: 3000 |
||||||
|
stringTagMap: |
||||||
|
RenderType: Transparent |
||||||
|
disabledShaderPasses: [] |
||||||
|
m_SavedProperties: |
||||||
|
serializedVersion: 3 |
||||||
|
m_TexEnvs: |
||||||
|
- _BumpMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailAlbedoMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailMask: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _DetailNormalMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _EmissionMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _MainTex: |
||||||
|
m_Texture: {fileID: 2800000, guid: 75f251dce8525154da22a5ea0a5caff0, type: 3} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _MetallicGlossMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _OcclusionMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
- _ParallaxMap: |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_Scale: {x: 1, y: 1} |
||||||
|
m_Offset: {x: 0, y: 0} |
||||||
|
m_Floats: |
||||||
|
- _BumpScale: 1 |
||||||
|
- _Cutoff: 0.5 |
||||||
|
- _DetailNormalMapScale: 1 |
||||||
|
- _DstBlend: 10 |
||||||
|
- _GlossMapScale: 1 |
||||||
|
- _Glossiness: 0 |
||||||
|
- _GlossyReflections: 1 |
||||||
|
- _Metallic: 0 |
||||||
|
- _Mode: 3 |
||||||
|
- _OcclusionStrength: 1 |
||||||
|
- _Parallax: 0.02 |
||||||
|
- _SmoothnessTextureChannel: 0 |
||||||
|
- _SpecularHighlights: 1 |
||||||
|
- _SrcBlend: 1 |
||||||
|
- _UVSec: 0 |
||||||
|
- _ZWrite: 0 |
||||||
|
m_Colors: |
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 0.44705883} |
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 219f223dc96cc934dbdfac3b0196e899 |
||||||
|
NativeFormatImporter: |
||||||
|
externalObjects: {} |
||||||
|
mainObjectFileID: 2100000 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,96 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &8734664957166163085 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 6853199470588153422} |
||||||
|
- component: {fileID: 1450647692940117777} |
||||||
|
- component: {fileID: 852470998154511825} |
||||||
|
- component: {fileID: 3101253239328018460} |
||||||
|
m_Layer: 0 |
||||||
|
m_Name: Plane |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!4 &6853199470588153422 |
||||||
|
Transform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 8734664957166163085} |
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||||
|
m_LocalPosition: {x: 4.48, y: -17.2, z: 40.66} |
||||||
|
m_LocalScale: {x: 7.38, y: 0.62043846, z: 5.1045003} |
||||||
|
m_Children: [] |
||||||
|
m_Father: {fileID: 0} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
--- !u!33 &1450647692940117777 |
||||||
|
MeshFilter: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 8734664957166163085} |
||||||
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} |
||||||
|
--- !u!23 &852470998154511825 |
||||||
|
MeshRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 8734664957166163085} |
||||||
|
m_Enabled: 1 |
||||||
|
m_CastShadows: 1 |
||||||
|
m_ReceiveShadows: 1 |
||||||
|
m_DynamicOccludee: 1 |
||||||
|
m_MotionVectors: 1 |
||||||
|
m_LightProbeUsage: 1 |
||||||
|
m_ReflectionProbeUsage: 1 |
||||||
|
m_RayTracingMode: 2 |
||||||
|
m_RenderingLayerMask: 1 |
||||||
|
m_RendererPriority: 0 |
||||||
|
m_Materials: |
||||||
|
- {fileID: 2100000, guid: 219f223dc96cc934dbdfac3b0196e899, type: 2} |
||||||
|
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!64 &3101253239328018460 |
||||||
|
MeshCollider: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 8734664957166163085} |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_IsTrigger: 0 |
||||||
|
m_Enabled: 1 |
||||||
|
serializedVersion: 4 |
||||||
|
m_Convex: 0 |
||||||
|
m_CookingOptions: 30 |
||||||
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2fbd227db341dfa46bef19c926d260cc |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,102 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: f818907ccd1cba142967f5ffaa6e2262 |
||||||
|
ModelImporter: |
||||||
|
serializedVersion: 19301 |
||||||
|
internalIDToNameTable: [] |
||||||
|
externalObjects: |
||||||
|
- first: |
||||||
|
type: UnityEngine:Material |
||||||
|
assembly: UnityEngine.CoreModule |
||||||
|
name: XFGX |
||||||
|
second: {fileID: 2100000, guid: 164ae163aaa5da046a49318b4faa9614, type: 2} |
||||||
|
materials: |
||||||
|
materialImportMode: 1 |
||||||
|
materialName: 0 |
||||||
|
materialSearch: 1 |
||||||
|
materialLocation: 1 |
||||||
|
animations: |
||||||
|
legacyGenerateAnimations: 4 |
||||||
|
bakeSimulation: 0 |
||||||
|
resampleCurves: 1 |
||||||
|
optimizeGameObjects: 0 |
||||||
|
motionNodeName: |
||||||
|
rigImportErrors: |
||||||
|
rigImportWarnings: |
||||||
|
animationImportErrors: |
||||||
|
animationImportWarnings: |
||||||
|
animationRetargetingWarnings: |
||||||
|
animationDoRetargetingWarnings: 0 |
||||||
|
importAnimatedCustomProperties: 0 |
||||||
|
importConstraints: 0 |
||||||
|
animationCompression: 1 |
||||||
|
animationRotationError: 0.5 |
||||||
|
animationPositionError: 0.5 |
||||||
|
animationScaleError: 0.5 |
||||||
|
animationWrapMode: 0 |
||||||
|
extraExposedTransformPaths: [] |
||||||
|
extraUserProperties: [] |
||||||
|
clipAnimations: [] |
||||||
|
isReadable: 0 |
||||||
|
meshes: |
||||||
|
lODScreenPercentages: [] |
||||||
|
globalScale: 1 |
||||||
|
meshCompression: 0 |
||||||
|
addColliders: 0 |
||||||
|
useSRGBMaterialColor: 1 |
||||||
|
sortHierarchyByName: 1 |
||||||
|
importVisibility: 1 |
||||||
|
importBlendShapes: 1 |
||||||
|
importCameras: 1 |
||||||
|
importLights: 1 |
||||||
|
fileIdsGeneration: 2 |
||||||
|
swapUVChannels: 0 |
||||||
|
generateSecondaryUV: 0 |
||||||
|
useFileUnits: 1 |
||||||
|
keepQuads: 0 |
||||||
|
weldVertices: 1 |
||||||
|
preserveHierarchy: 0 |
||||||
|
skinWeightsMode: 0 |
||||||
|
maxBonesPerVertex: 4 |
||||||
|
minBoneWeight: 0.001 |
||||||
|
meshOptimizationFlags: -1 |
||||||
|
indexFormat: 0 |
||||||
|
secondaryUVAngleDistortion: 8 |
||||||
|
secondaryUVAreaDistortion: 15.000001 |
||||||
|
secondaryUVHardAngle: 88 |
||||||
|
secondaryUVPackMargin: 4 |
||||||
|
useFileScale: 1 |
||||||
|
tangentSpace: |
||||||
|
normalSmoothAngle: 60 |
||||||
|
normalImportMode: 0 |
||||||
|
tangentImportMode: 3 |
||||||
|
normalCalculationMode: 4 |
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 |
||||||
|
blendShapeNormalImportMode: 1 |
||||||
|
normalSmoothingSource: 0 |
||||||
|
referencedClips: [] |
||||||
|
importAnimation: 1 |
||||||
|
humanDescription: |
||||||
|
serializedVersion: 3 |
||||||
|
human: [] |
||||||
|
skeleton: [] |
||||||
|
armTwist: 0.5 |
||||||
|
foreArmTwist: 0.5 |
||||||
|
upperLegTwist: 0.5 |
||||||
|
legTwist: 0.5 |
||||||
|
armStretch: 0.05 |
||||||
|
legStretch: 0.05 |
||||||
|
feetSpacing: 0 |
||||||
|
globalScale: 1 |
||||||
|
rootMotionBoneName: |
||||||
|
hasTranslationDoF: 0 |
||||||
|
hasExtraRoot: 0 |
||||||
|
skeletonHasParents: 1 |
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0} |
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1 |
||||||
|
animationType: 2 |
||||||
|
humanoidOversampling: 1 |
||||||
|
avatarSetup: 0 |
||||||
|
additionalBone: 0 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Binary file not shown.
After Width: | Height: | Size: 383 KiB |
@ -0,0 +1,92 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 75f251dce8525154da22a5ea0a5caff0 |
||||||
|
TextureImporter: |
||||||
|
internalIDToNameTable: [] |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 11 |
||||||
|
mipmaps: |
||||||
|
mipMapMode: 0 |
||||||
|
enableMipMap: 1 |
||||||
|
sRGBTexture: 1 |
||||||
|
linearTexture: 0 |
||||||
|
fadeOut: 0 |
||||||
|
borderMipMap: 0 |
||||||
|
mipMapsPreserveCoverage: 0 |
||||||
|
alphaTestReferenceValue: 0.5 |
||||||
|
mipMapFadeDistanceStart: 1 |
||||||
|
mipMapFadeDistanceEnd: 3 |
||||||
|
bumpmap: |
||||||
|
convertToNormalMap: 0 |
||||||
|
externalNormalMap: 0 |
||||||
|
heightScale: 0.25 |
||||||
|
normalMapFilter: 0 |
||||||
|
isReadable: 0 |
||||||
|
streamingMipmaps: 0 |
||||||
|
streamingMipmapsPriority: 0 |
||||||
|
grayScaleToAlpha: 0 |
||||||
|
generateCubemap: 6 |
||||||
|
cubemapConvolution: 0 |
||||||
|
seamlessCubemap: 0 |
||||||
|
textureFormat: 1 |
||||||
|
maxTextureSize: 2048 |
||||||
|
textureSettings: |
||||||
|
serializedVersion: 2 |
||||||
|
filterMode: 1 |
||||||
|
aniso: 1 |
||||||
|
mipBias: 0 |
||||||
|
wrapU: 0 |
||||||
|
wrapV: 0 |
||||||
|
wrapW: 0 |
||||||
|
nPOTScale: 1 |
||||||
|
lightmap: 0 |
||||||
|
compressionQuality: 50 |
||||||
|
spriteMode: 0 |
||||||
|
spriteExtrude: 1 |
||||||
|
spriteMeshType: 1 |
||||||
|
alignment: 0 |
||||||
|
spritePivot: {x: 0.5, y: 0.5} |
||||||
|
spritePixelsToUnits: 100 |
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
||||||
|
spriteGenerateFallbackPhysicsShape: 1 |
||||||
|
alphaUsage: 1 |
||||||
|
alphaIsTransparency: 0 |
||||||
|
spriteTessellationDetail: -1 |
||||||
|
textureType: 0 |
||||||
|
textureShape: 1 |
||||||
|
singleChannelComponent: 0 |
||||||
|
maxTextureSizeSet: 0 |
||||||
|
compressionQualitySet: 0 |
||||||
|
textureFormatSet: 0 |
||||||
|
applyGammaDecoding: 0 |
||||||
|
platformSettings: |
||||||
|
- serializedVersion: 3 |
||||||
|
buildTarget: DefaultTexturePlatform |
||||||
|
maxTextureSize: 2048 |
||||||
|
resizeAlgorithm: 0 |
||||||
|
textureFormat: -1 |
||||||
|
textureCompression: 1 |
||||||
|
compressionQuality: 50 |
||||||
|
crunchedCompression: 0 |
||||||
|
allowsAlphaSplitting: 0 |
||||||
|
overridden: 0 |
||||||
|
androidETC2FallbackOverride: 0 |
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0 |
||||||
|
spriteSheet: |
||||||
|
serializedVersion: 2 |
||||||
|
sprites: [] |
||||||
|
outline: [] |
||||||
|
physicsShape: [] |
||||||
|
bones: [] |
||||||
|
spriteID: |
||||||
|
internalID: 0 |
||||||
|
vertices: [] |
||||||
|
indices: |
||||||
|
edges: [] |
||||||
|
weights: [] |
||||||
|
secondaryTextures: [] |
||||||
|
spritePackingTag: |
||||||
|
pSDRemoveMatte: 0 |
||||||
|
pSDShowRemoveMatteOption: 0 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Binary file not shown.
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c43d6f4c8df752448b293354558290a5 |
||||||
|
NativeFormatImporter: |
||||||
|
externalObjects: {} |
||||||
|
mainObjectFileID: 23800000 |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,95 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &828837962821698955 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 2766332253738962693} |
||||||
|
- component: {fileID: 4441406424967128446} |
||||||
|
- component: {fileID: 2194364438564339512} |
||||||
|
- component: {fileID: 124552416461216991} |
||||||
|
m_Layer: 0 |
||||||
|
m_Name: 1050 |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!4 &2766332253738962693 |
||||||
|
Transform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 828837962821698955} |
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
||||||
|
m_LocalPosition: {x: -12.29, y: -17.561468, z: 44.57} |
||||||
|
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!33 &4441406424967128446 |
||||||
|
MeshFilter: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 828837962821698955} |
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
||||||
|
--- !u!23 &2194364438564339512 |
||||||
|
MeshRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 828837962821698955} |
||||||
|
m_Enabled: 1 |
||||||
|
m_CastShadows: 1 |
||||||
|
m_ReceiveShadows: 1 |
||||||
|
m_DynamicOccludee: 1 |
||||||
|
m_MotionVectors: 1 |
||||||
|
m_LightProbeUsage: 1 |
||||||
|
m_ReflectionProbeUsage: 1 |
||||||
|
m_RayTracingMode: 2 |
||||||
|
m_RenderingLayerMask: 1 |
||||||
|
m_RendererPriority: 0 |
||||||
|
m_Materials: |
||||||
|
- {fileID: 10303, 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!65 &124552416461216991 |
||||||
|
BoxCollider: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 828837962821698955} |
||||||
|
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} |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1d7e2089fedd15042abdf9c3d51f9f45 |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,95 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &2167326369605691856 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 2126840323371821178} |
||||||
|
- component: {fileID: 8179030164542162640} |
||||||
|
- component: {fileID: 1293765920705320252} |
||||||
|
- component: {fileID: 8205304985678027396} |
||||||
|
m_Layer: 0 |
||||||
|
m_Name: 1070 |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!4 &2126840323371821178 |
||||||
|
Transform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2167326369605691856} |
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
||||||
|
m_LocalPosition: {x: -17.22, y: -17.561468, z: 44.57} |
||||||
|
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!33 &8179030164542162640 |
||||||
|
MeshFilter: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2167326369605691856} |
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
||||||
|
--- !u!23 &1293765920705320252 |
||||||
|
MeshRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2167326369605691856} |
||||||
|
m_Enabled: 1 |
||||||
|
m_CastShadows: 1 |
||||||
|
m_ReceiveShadows: 1 |
||||||
|
m_DynamicOccludee: 1 |
||||||
|
m_MotionVectors: 1 |
||||||
|
m_LightProbeUsage: 1 |
||||||
|
m_ReflectionProbeUsage: 1 |
||||||
|
m_RayTracingMode: 2 |
||||||
|
m_RenderingLayerMask: 1 |
||||||
|
m_RendererPriority: 0 |
||||||
|
m_Materials: |
||||||
|
- {fileID: 10303, 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!65 &8205304985678027396 |
||||||
|
BoxCollider: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2167326369605691856} |
||||||
|
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} |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 4f1c609155d280f428054b156f3d6329 |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,95 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &3613886137469071075 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 6356296298930090679} |
||||||
|
- component: {fileID: 190299783482546276} |
||||||
|
- component: {fileID: 8925865812028571756} |
||||||
|
- component: {fileID: 929843984405384557} |
||||||
|
m_Layer: 0 |
||||||
|
m_Name: 1090 |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!4 &6356296298930090679 |
||||||
|
Transform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3613886137469071075} |
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
||||||
|
m_LocalPosition: {x: -12.29, y: -17.561468, z: 42.07} |
||||||
|
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!33 &190299783482546276 |
||||||
|
MeshFilter: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3613886137469071075} |
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
||||||
|
--- !u!23 &8925865812028571756 |
||||||
|
MeshRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3613886137469071075} |
||||||
|
m_Enabled: 1 |
||||||
|
m_CastShadows: 1 |
||||||
|
m_ReceiveShadows: 1 |
||||||
|
m_DynamicOccludee: 1 |
||||||
|
m_MotionVectors: 1 |
||||||
|
m_LightProbeUsage: 1 |
||||||
|
m_ReflectionProbeUsage: 1 |
||||||
|
m_RayTracingMode: 2 |
||||||
|
m_RenderingLayerMask: 1 |
||||||
|
m_RendererPriority: 0 |
||||||
|
m_Materials: |
||||||
|
- {fileID: 10303, 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!65 &929843984405384557 |
||||||
|
BoxCollider: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3613886137469071075} |
||||||
|
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} |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 935df60b1b4260d4eadaf4734a4e4c1d |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,99 @@ |
|||||||
|
using AX.MessageSystem; |
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.UI; |
||||||
|
|
||||||
|
public class DeviceFollowTarget : MonoBehaviour |
||||||
|
{ |
||||||
|
public List<Sprite> spList = new List<Sprite>(); |
||||||
|
public Transform target; |
||||||
|
public Camera uiCamera; |
||||||
|
private float offset_Y = 2.5f; |
||||||
|
|
||||||
|
private void Start() |
||||||
|
{ |
||||||
|
GetComponent<Button>().onClick.AddListener(ViewClick); |
||||||
|
uiCamera = GameObject.Find("Canvas").GetComponent<Canvas>().worldCamera; |
||||||
|
} |
||||||
|
public void ViewClick() |
||||||
|
{ |
||||||
|
if (GetComponent<DeviceLumos>() && DeviceInfo.Instance.gameObject.activeSelf) |
||||||
|
return; |
||||||
|
if (FindObjectOfType<FloorButtonsPanel>()) |
||||||
|
FindObjectOfType<FloorButtonsPanel>().ChangeFloor(target.GetComponent<DeviceObj>().floorId); |
||||||
|
Camera.main.GetComponent<CameraOrbit>().SetCameraView(target.position, 15); |
||||||
|
if (target && target.GetComponent<DeviceObj>()) |
||||||
|
{ |
||||||
|
DevicePanelManager.Instance.NowClickObject = target.GetComponent<DeviceObj>(); |
||||||
|
if (!target.GetComponent<DeviceLumos>()) |
||||||
|
{ |
||||||
|
target.gameObject.AddComponent<DeviceLumos>(); |
||||||
|
} |
||||||
|
if (!GetComponent<DeviceLumos>()) |
||||||
|
gameObject.AddComponent<DeviceLumos>(); |
||||||
|
|
||||||
|
if (target.GetComponent<DeviceObj>().BindData.deviceNo != null) |
||||||
|
{ |
||||||
|
DeviceInfo.Instance.OnShow(target.GetComponent<DeviceObj>().BindData); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
target.GetComponent<DeviceObj>().SetBindData(); |
||||||
|
DeviceInfo.Instance.OnShow(target.GetComponent<DeviceObj>().BindData); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private Vector2 WorldPosToUIPos(Vector3 worldPos) |
||||||
|
{ |
||||||
|
Vector2 world2ScreenPos = Camera.main.WorldToScreenPoint(worldPos); |
||||||
|
Vector2 uiPos = new Vector2(); |
||||||
|
RectTransformUtility.ScreenPointToLocalPointInRectangle(transform.parent.GetComponent<RectTransform>(), world2ScreenPos, uiCamera, out uiPos); |
||||||
|
return uiPos; |
||||||
|
} |
||||||
|
private void OnDisable() |
||||||
|
{ |
||||||
|
if (GetComponent<DeviceLumos>()) |
||||||
|
{ |
||||||
|
Destroy(GetComponent<DeviceLumos>()); |
||||||
|
} |
||||||
|
} |
||||||
|
private void LateUpdate() |
||||||
|
{ |
||||||
|
if (gameObject.activeSelf && target) |
||||||
|
{ |
||||||
|
GetComponent<RectTransform>().anchoredPosition = |
||||||
|
WorldPosToUIPos(new Vector3(target.transform.position.x, target.transform.position.y + offset_Y, target.transform.position.z)); |
||||||
|
} |
||||||
|
if (GetComponent<DeviceLumos>()) |
||||||
|
{ |
||||||
|
if (target && DevicePanelManager.Instance.NowClickObject != target.GetComponent<DeviceObj>()) |
||||||
|
{ |
||||||
|
Destroy(GetComponent<DeviceLumos>()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void SetTarget(DeviceObj deviceObj) |
||||||
|
{ |
||||||
|
target = deviceObj.transform; |
||||||
|
if (deviceObj.BindType == DeviceType.排烟风机 || |
||||||
|
deviceObj.BindType == DeviceType.补风机 || |
||||||
|
deviceObj.BindType == DeviceType.送风机) |
||||||
|
{ |
||||||
|
GetComponent<Image>().sprite = spList[spList.Count - 1]; |
||||||
|
return; |
||||||
|
} |
||||||
|
foreach (var item in spList) |
||||||
|
{ |
||||||
|
if (deviceObj.BindType.ToString() == item.name) |
||||||
|
{ |
||||||
|
GetComponent<Image>().sprite = item; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 0526089f5df3b684ca63d3fcae2ba54f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,69 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.UI; |
||||||
|
|
||||||
|
[DisallowMultipleComponent] |
||||||
|
public class DeviceLumos : MonoBehaviour |
||||||
|
{ |
||||||
|
public Color NormalColor = Color.white; |
||||||
|
public Color TargetColor = Color.red; |
||||||
|
|
||||||
|
private float time; |
||||||
|
private bool LumosReady; |
||||||
|
private float Interval = 0.5f; |
||||||
|
|
||||||
|
private void Awake() |
||||||
|
{ |
||||||
|
if (GetComponent<Renderer>()) |
||||||
|
{ |
||||||
|
NormalColor = GetComponent<Renderer>().material.color; |
||||||
|
TargetColor = Color.red; |
||||||
|
} |
||||||
|
else if (GetComponent<Image>()) |
||||||
|
{ |
||||||
|
NormalColor = GetComponent<Image>().color; |
||||||
|
TargetColor = Color.green; |
||||||
|
} |
||||||
|
} |
||||||
|
private void LateUpdate() |
||||||
|
{ |
||||||
|
time += Time.deltaTime; |
||||||
|
if (time > Interval) |
||||||
|
{ |
||||||
|
time = 0.0f; |
||||||
|
LumosReady = !LumosReady; |
||||||
|
} |
||||||
|
if (GetComponent<Renderer>()) |
||||||
|
{ |
||||||
|
if (LumosReady) |
||||||
|
{ |
||||||
|
GetComponent<Renderer>().material.SetColor("_Color", NormalColor); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
GetComponent<Renderer>().material.SetColor("_Color", TargetColor); |
||||||
|
} |
||||||
|
} |
||||||
|
else if (GetComponent<Image>()) |
||||||
|
{ |
||||||
|
if (LumosReady) |
||||||
|
{ |
||||||
|
GetComponent<Image>().color = NormalColor; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
GetComponent<Image>().color = TargetColor; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
private void OnDestroy() |
||||||
|
{ |
||||||
|
if (GetComponent<Renderer>()) |
||||||
|
{ |
||||||
|
GetComponent<Renderer>().material.SetColor("_Color", NormalColor); |
||||||
|
} |
||||||
|
else if (GetComponent<Image>()) |
||||||
|
{ |
||||||
|
GetComponent<Image>().color = NormalColor; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2c0daed4e09401f4dbf0bc6021761e17 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,32 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.UI; |
||||||
|
using AX.MessageSystem; |
||||||
|
|
||||||
|
[RequireComponent(typeof(Toggle))] |
||||||
|
public class DeviceMenuToggle : MonoBehaviour |
||||||
|
{ |
||||||
|
public DeviceType menuType; |
||||||
|
private Toggle M_toggle; |
||||||
|
void Start() |
||||||
|
{ |
||||||
|
M_toggle = GetComponent<Toggle>(); |
||||||
|
M_toggle.onValueChanged.AddListener(M_toggle_ValueChanged); |
||||||
|
} |
||||||
|
|
||||||
|
private void M_toggle_ValueChanged(bool isOn) |
||||||
|
{ |
||||||
|
if (isOn) |
||||||
|
{ |
||||||
|
DevicePanelManager.Instance.ShowBindList(menuType); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
DevicePanelManager.Instance.ShowBindList(DeviceType.空); |
||||||
|
} |
||||||
|
|
||||||
|
MessageDispatcher.SendMessage("DeviceMenuChanged", new KeyValuePair<DeviceType, bool>(menuType, isOn)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d52e25c232aba6a42a4bd0e25637df8b |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,174 @@ |
|||||||
|
using AX.MessageSystem; |
||||||
|
using Newtonsoft.Json; |
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
[Serializable] |
||||||
|
public class DeviceCloneData |
||||||
|
{ |
||||||
|
public string name; |
||||||
|
public int floorId; |
||||||
|
public DeviceType type; |
||||||
|
public Vector3 postion; |
||||||
|
} |
||||||
|
public class DeviceObjManager : MonoBehaviour |
||||||
|
{ |
||||||
|
public static DeviceObjManager Instance; |
||||||
|
public GameObject Point; |
||||||
|
public List<DeviceCloneData> NowPointList = new List<DeviceCloneData>(); |
||||||
|
|
||||||
|
private string objId = "objlistid"; |
||||||
|
|
||||||
|
private void Awake() |
||||||
|
{ |
||||||
|
MessageDispatcher.AddListener("ConfigLoadOver", ConfigLoadOver); |
||||||
|
Instance = this; |
||||||
|
} |
||||||
|
private void Start() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
private void OnDestroy() |
||||||
|
{ |
||||||
|
MessageDispatcher.RemoveListener("ConfigLoadOver", ConfigLoadOver); |
||||||
|
} |
||||||
|
private void ConfigLoadOver(IMessage obj) |
||||||
|
{ |
||||||
|
LoadDeviceObjs(); |
||||||
|
} |
||||||
|
private void Update() |
||||||
|
{ |
||||||
|
if (Input.GetKey(KeyCode.Q)) |
||||||
|
{ |
||||||
|
if (Input.GetKeyDown(KeyCode.Delete)) |
||||||
|
{ |
||||||
|
if (DevicePanelManager.Instance.MenuType == DeviceType.空) |
||||||
|
{ |
||||||
|
NowPointList.Clear(); |
||||||
|
SaveObjs(); |
||||||
|
return; |
||||||
|
} |
||||||
|
for (int i = 0; i < NowPointList.Count; i++) |
||||||
|
{ |
||||||
|
if (NowPointList[i].type == DevicePanelManager.Instance.MenuType) |
||||||
|
{ |
||||||
|
NowPointList.RemoveAt(i); |
||||||
|
i--; |
||||||
|
} |
||||||
|
} |
||||||
|
SaveObjs(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
public DeviceObj GetDeviceByName(string dname) |
||||||
|
{ |
||||||
|
DeviceObj result = null; |
||||||
|
foreach (Transform item in transform) |
||||||
|
{ |
||||||
|
if (item.name == dname) |
||||||
|
{ |
||||||
|
result = item.GetComponent<DeviceObj>(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
public void AddObj(string objName) |
||||||
|
{ |
||||||
|
foreach (Transform item in transform) |
||||||
|
{ |
||||||
|
if (item.name == objName && item.GetComponent<DeviceObj>()) |
||||||
|
{ |
||||||
|
var obj = new DeviceCloneData(); |
||||||
|
obj.name = item.name; |
||||||
|
obj.postion = item.position; |
||||||
|
obj.floorId = item.GetComponent<DeviceObj>().floorId; |
||||||
|
obj.type = item.GetComponent<DeviceObj>().BindType; |
||||||
|
bool has = false; |
||||||
|
foreach (var data in NowPointList) |
||||||
|
{ |
||||||
|
if (data.name == obj.name) |
||||||
|
{ |
||||||
|
data.postion = obj.postion; |
||||||
|
data.type = obj.type; |
||||||
|
has = true; |
||||||
|
} |
||||||
|
} |
||||||
|
if (!has) |
||||||
|
{ |
||||||
|
NowPointList.Add(obj); |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
SaveObjs(); |
||||||
|
} |
||||||
|
public void DelObj(string objName) |
||||||
|
{ |
||||||
|
foreach (var item in DevicePanelManager.Instance.BindObjectList) |
||||||
|
{ |
||||||
|
if (item.ObjName == objName) |
||||||
|
{ |
||||||
|
item.ObjName = ""; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
DevicePanelManager.Instance.SaveDeviceObjConfig(); |
||||||
|
for (int i = 0; i < NowPointList.Count; i++) |
||||||
|
{ |
||||||
|
if (NowPointList[i].name == objName) |
||||||
|
{ |
||||||
|
NowPointList.Remove(NowPointList[i]); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
SaveObjs(); |
||||||
|
} |
||||||
|
public void SaveObjs() |
||||||
|
{ |
||||||
|
var json = JsonConvert.SerializeObject(NowPointList); |
||||||
|
string url = string.Format(HttpManager.Instance.PostIOilTankById, objId); |
||||||
|
if (Application.platform == RuntimePlatform.WebGLPlayer) |
||||||
|
{ |
||||||
|
url = url.Substring(url.IndexOf("api") - 1); |
||||||
|
} |
||||||
|
HttpManager.Instance.Post(url, json, () => |
||||||
|
{ |
||||||
|
Debug.Log("保存点位成功!"); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void LoadDeviceObjs() |
||||||
|
{ |
||||||
|
try |
||||||
|
{ |
||||||
|
string url = string.Format(HttpManager.Instance.GetOilTankById, objId); |
||||||
|
Debug.Log($"the url is :{ url}"); |
||||||
|
if (Application.platform == RuntimePlatform.WebGLPlayer) |
||||||
|
{ |
||||||
|
url = url.Substring(url.IndexOf("api") - 1); |
||||||
|
} |
||||||
|
HttpManager.Instance.Get<string>(url, d => |
||||||
|
{ |
||||||
|
NowPointList = JsonConvert.DeserializeObject<List<DeviceCloneData>>(d); |
||||||
|
foreach (Transform item in transform) |
||||||
|
{ |
||||||
|
Destroy(item.gameObject); |
||||||
|
} |
||||||
|
foreach (var item in NowPointList) |
||||||
|
{ |
||||||
|
GameObject go = Instantiate(Point, item.postion, Quaternion.identity, transform); |
||||||
|
go.name = item.name; |
||||||
|
go.GetComponent<DeviceObj>().CreateIcon(item.type, item.floorId); |
||||||
|
SelectionManager.Instance.Sets.Add(go); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
catch |
||||||
|
{ |
||||||
|
Debug.LogError("暂无数据!"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a574343a24c732d4b85cd8c6f01e2b2a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 628850431d824da4db27d868dcdd0d0f |
||||||
|
folderAsset: yes |
||||||
|
DefaultImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,9 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 63b588f3892bb4b5eb73ad3d2791e05c |
||||||
|
folderAsset: yes |
||||||
|
timeCreated: 1477656493 |
||||||
|
licenseType: Pro |
||||||
|
DefaultImporter: |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,258 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.AI; |
||||||
|
|
||||||
|
namespace UnityEditor.AI |
||||||
|
{ |
||||||
|
public static class NavMeshComponentsGUIUtility |
||||||
|
{ |
||||||
|
public static void AreaPopup(string labelName, SerializedProperty areaProperty) |
||||||
|
{ |
||||||
|
var areaIndex = -1; |
||||||
|
var areaNames = GameObjectUtility.GetNavMeshAreaNames(); |
||||||
|
for (var i = 0; i < areaNames.Length; i++) |
||||||
|
{ |
||||||
|
var areaValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[i]); |
||||||
|
if (areaValue == areaProperty.intValue) |
||||||
|
areaIndex = i; |
||||||
|
} |
||||||
|
ArrayUtility.Add(ref areaNames, ""); |
||||||
|
ArrayUtility.Add(ref areaNames, "Open Area Settings..."); |
||||||
|
|
||||||
|
var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight); |
||||||
|
EditorGUI.BeginProperty(rect, GUIContent.none, areaProperty); |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
areaIndex = EditorGUI.Popup(rect, labelName, areaIndex, areaNames); |
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
if (areaIndex >= 0 && areaIndex < areaNames.Length - 2) |
||||||
|
areaProperty.intValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[areaIndex]); |
||||||
|
else if (areaIndex == areaNames.Length - 1) |
||||||
|
NavMeshEditorHelpers.OpenAreaSettings(); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.EndProperty(); |
||||||
|
} |
||||||
|
|
||||||
|
public static void AgentTypePopup(string labelName, SerializedProperty agentTypeID) |
||||||
|
{ |
||||||
|
var index = -1; |
||||||
|
var count = NavMesh.GetSettingsCount(); |
||||||
|
var agentTypeNames = new string[count + 2]; |
||||||
|
for (var i = 0; i < count; i++) |
||||||
|
{ |
||||||
|
var id = NavMesh.GetSettingsByIndex(i).agentTypeID; |
||||||
|
var name = NavMesh.GetSettingsNameFromID(id); |
||||||
|
agentTypeNames[i] = name; |
||||||
|
if (id == agentTypeID.intValue) |
||||||
|
index = i; |
||||||
|
} |
||||||
|
agentTypeNames[count] = ""; |
||||||
|
agentTypeNames[count + 1] = "Open Agent Settings..."; |
||||||
|
|
||||||
|
bool validAgentType = index != -1; |
||||||
|
if (!validAgentType) |
||||||
|
{ |
||||||
|
EditorGUILayout.HelpBox("Agent Type invalid.", MessageType.Warning); |
||||||
|
} |
||||||
|
|
||||||
|
var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight); |
||||||
|
EditorGUI.BeginProperty(rect, GUIContent.none, agentTypeID); |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
index = EditorGUI.Popup(rect, labelName, index, agentTypeNames); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
if (index >= 0 && index < count) |
||||||
|
{ |
||||||
|
var id = NavMesh.GetSettingsByIndex(index).agentTypeID; |
||||||
|
agentTypeID.intValue = id; |
||||||
|
} |
||||||
|
else if (index == count + 1) |
||||||
|
{ |
||||||
|
NavMeshEditorHelpers.OpenAgentSettings(-1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.EndProperty(); |
||||||
|
} |
||||||
|
|
||||||
|
// Agent mask is a set (internally array/list) of agentTypeIDs. |
||||||
|
// It is used to describe which agents modifiers apply to. |
||||||
|
// There is a special case of "None" which is an empty array. |
||||||
|
// There is a special case of "All" which is an array of length 1, and value of -1. |
||||||
|
public static void AgentMaskPopup(string labelName, SerializedProperty agentMask) |
||||||
|
{ |
||||||
|
// Contents of the dropdown box. |
||||||
|
string popupContent = ""; |
||||||
|
|
||||||
|
if (agentMask.hasMultipleDifferentValues) |
||||||
|
popupContent = "\u2014"; |
||||||
|
else |
||||||
|
popupContent = GetAgentMaskLabelName(agentMask); |
||||||
|
|
||||||
|
var content = new GUIContent(popupContent); |
||||||
|
var popupRect = GUILayoutUtility.GetRect(content, EditorStyles.popup); |
||||||
|
|
||||||
|
EditorGUI.BeginProperty(popupRect, GUIContent.none, agentMask); |
||||||
|
popupRect = EditorGUI.PrefixLabel(popupRect, 0, new GUIContent(labelName)); |
||||||
|
bool pressed = GUI.Button(popupRect, content, EditorStyles.popup); |
||||||
|
|
||||||
|
if (pressed) |
||||||
|
{ |
||||||
|
var show = !agentMask.hasMultipleDifferentValues; |
||||||
|
var showNone = show && agentMask.arraySize == 0; |
||||||
|
var showAll = show && IsAll(agentMask); |
||||||
|
|
||||||
|
var menu = new GenericMenu(); |
||||||
|
menu.AddItem(new GUIContent("None"), showNone, SetAgentMaskNone, agentMask); |
||||||
|
menu.AddItem(new GUIContent("All"), showAll, SetAgentMaskAll, agentMask); |
||||||
|
menu.AddSeparator(""); |
||||||
|
|
||||||
|
var count = NavMesh.GetSettingsCount(); |
||||||
|
for (var i = 0; i < count; i++) |
||||||
|
{ |
||||||
|
var id = NavMesh.GetSettingsByIndex(i).agentTypeID; |
||||||
|
var sname = NavMesh.GetSettingsNameFromID(id); |
||||||
|
|
||||||
|
var showSelected = show && AgentMaskHasSelectedAgentTypeID(agentMask, id); |
||||||
|
var userData = new object[] { agentMask, id, !showSelected }; |
||||||
|
menu.AddItem(new GUIContent(sname), showSelected, ToggleAgentMaskItem, userData); |
||||||
|
} |
||||||
|
|
||||||
|
menu.DropDown(popupRect); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.EndProperty(); |
||||||
|
} |
||||||
|
|
||||||
|
public static GameObject CreateAndSelectGameObject(string suggestedName, GameObject parent) |
||||||
|
{ |
||||||
|
var parentTransform = parent != null ? parent.transform : null; |
||||||
|
var uniqueName = GameObjectUtility.GetUniqueNameForSibling(parentTransform, suggestedName); |
||||||
|
var child = new GameObject(uniqueName); |
||||||
|
|
||||||
|
Undo.RegisterCreatedObjectUndo(child, "Create " + uniqueName); |
||||||
|
if (parentTransform != null) |
||||||
|
Undo.SetTransformParent(child.transform, parentTransform, "Parent " + uniqueName); |
||||||
|
|
||||||
|
Selection.activeGameObject = child; |
||||||
|
|
||||||
|
return child; |
||||||
|
} |
||||||
|
|
||||||
|
static bool IsAll(SerializedProperty agentMask) |
||||||
|
{ |
||||||
|
return agentMask.arraySize == 1 && agentMask.GetArrayElementAtIndex(0).intValue == -1; |
||||||
|
} |
||||||
|
|
||||||
|
static void ToggleAgentMaskItem(object userData) |
||||||
|
{ |
||||||
|
var args = (object[])userData; |
||||||
|
var agentMask = (SerializedProperty)args[0]; |
||||||
|
var agentTypeID = (int)args[1]; |
||||||
|
var value = (bool)args[2]; |
||||||
|
|
||||||
|
ToggleAgentMaskItem(agentMask, agentTypeID, value); |
||||||
|
} |
||||||
|
|
||||||
|
static void ToggleAgentMaskItem(SerializedProperty agentMask, int agentTypeID, bool value) |
||||||
|
{ |
||||||
|
if (agentMask.hasMultipleDifferentValues) |
||||||
|
{ |
||||||
|
agentMask.ClearArray(); |
||||||
|
agentMask.serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
|
||||||
|
// Find which index this agent type is in the agentMask array. |
||||||
|
int idx = -1; |
||||||
|
for (var j = 0; j < agentMask.arraySize; j++) |
||||||
|
{ |
||||||
|
var elem = agentMask.GetArrayElementAtIndex(j); |
||||||
|
if (elem.intValue == agentTypeID) |
||||||
|
idx = j; |
||||||
|
} |
||||||
|
|
||||||
|
// Handle "All" special case. |
||||||
|
if (IsAll(agentMask)) |
||||||
|
{ |
||||||
|
agentMask.DeleteArrayElementAtIndex(0); |
||||||
|
} |
||||||
|
|
||||||
|
// Toggle value. |
||||||
|
if (value) |
||||||
|
{ |
||||||
|
if (idx == -1) |
||||||
|
{ |
||||||
|
agentMask.InsertArrayElementAtIndex(agentMask.arraySize); |
||||||
|
agentMask.GetArrayElementAtIndex(agentMask.arraySize - 1).intValue = agentTypeID; |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (idx != -1) |
||||||
|
{ |
||||||
|
agentMask.DeleteArrayElementAtIndex(idx); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
agentMask.serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
|
||||||
|
static void SetAgentMaskNone(object data) |
||||||
|
{ |
||||||
|
var agentMask = (SerializedProperty)data; |
||||||
|
agentMask.ClearArray(); |
||||||
|
agentMask.serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
|
||||||
|
static void SetAgentMaskAll(object data) |
||||||
|
{ |
||||||
|
var agentMask = (SerializedProperty)data; |
||||||
|
agentMask.ClearArray(); |
||||||
|
agentMask.InsertArrayElementAtIndex(0); |
||||||
|
agentMask.GetArrayElementAtIndex(0).intValue = -1; |
||||||
|
agentMask.serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
|
||||||
|
static string GetAgentMaskLabelName(SerializedProperty agentMask) |
||||||
|
{ |
||||||
|
if (agentMask.arraySize == 0) |
||||||
|
return "None"; |
||||||
|
|
||||||
|
if (IsAll(agentMask)) |
||||||
|
return "All"; |
||||||
|
|
||||||
|
if (agentMask.arraySize <= 3) |
||||||
|
{ |
||||||
|
var labelName = ""; |
||||||
|
for (var j = 0; j < agentMask.arraySize; j++) |
||||||
|
{ |
||||||
|
var elem = agentMask.GetArrayElementAtIndex(j); |
||||||
|
var settingsName = NavMesh.GetSettingsNameFromID(elem.intValue); |
||||||
|
if (string.IsNullOrEmpty(settingsName)) |
||||||
|
continue; |
||||||
|
|
||||||
|
if (labelName.Length > 0) |
||||||
|
labelName += ", "; |
||||||
|
labelName += settingsName; |
||||||
|
} |
||||||
|
return labelName; |
||||||
|
} |
||||||
|
|
||||||
|
return "Mixed..."; |
||||||
|
} |
||||||
|
|
||||||
|
static bool AgentMaskHasSelectedAgentTypeID(SerializedProperty agentMask, int agentTypeID) |
||||||
|
{ |
||||||
|
for (var j = 0; j < agentMask.arraySize; j++) |
||||||
|
{ |
||||||
|
var elem = agentMask.GetArrayElementAtIndex(j); |
||||||
|
if (elem.intValue == agentTypeID) |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 77fba670b979046f18d52d751e0d4659 |
||||||
|
timeCreated: 1480524815 |
||||||
|
licenseType: Pro |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,279 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.AI; |
||||||
|
|
||||||
|
namespace UnityEditor.AI |
||||||
|
{ |
||||||
|
[CanEditMultipleObjects] |
||||||
|
[CustomEditor(typeof(NavMeshLink))] |
||||||
|
class NavMeshLinkEditor : Editor |
||||||
|
{ |
||||||
|
SerializedProperty m_AgentTypeID; |
||||||
|
SerializedProperty m_Area; |
||||||
|
SerializedProperty m_CostModifier; |
||||||
|
SerializedProperty m_AutoUpdatePosition; |
||||||
|
SerializedProperty m_Bidirectional; |
||||||
|
SerializedProperty m_EndPoint; |
||||||
|
SerializedProperty m_StartPoint; |
||||||
|
SerializedProperty m_Width; |
||||||
|
|
||||||
|
static int s_SelectedID; |
||||||
|
static int s_SelectedPoint = -1; |
||||||
|
|
||||||
|
static Color s_HandleColor = new Color(255f, 167f, 39f, 210f) / 255; |
||||||
|
static Color s_HandleColorDisabled = new Color(255f * 0.75f, 167f * 0.75f, 39f * 0.75f, 100f) / 255; |
||||||
|
|
||||||
|
void OnEnable() |
||||||
|
{ |
||||||
|
m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID"); |
||||||
|
m_Area = serializedObject.FindProperty("m_Area"); |
||||||
|
m_CostModifier = serializedObject.FindProperty("m_CostModifier"); |
||||||
|
m_AutoUpdatePosition = serializedObject.FindProperty("m_AutoUpdatePosition"); |
||||||
|
m_Bidirectional = serializedObject.FindProperty("m_Bidirectional"); |
||||||
|
m_EndPoint = serializedObject.FindProperty("m_EndPoint"); |
||||||
|
m_StartPoint = serializedObject.FindProperty("m_StartPoint"); |
||||||
|
m_Width = serializedObject.FindProperty("m_Width"); |
||||||
|
|
||||||
|
s_SelectedID = 0; |
||||||
|
s_SelectedPoint = -1; |
||||||
|
|
||||||
|
NavMeshVisualizationSettings.showNavigation++; |
||||||
|
} |
||||||
|
|
||||||
|
void OnDisable() |
||||||
|
{ |
||||||
|
NavMeshVisualizationSettings.showNavigation--; |
||||||
|
} |
||||||
|
|
||||||
|
static Matrix4x4 UnscaledLocalToWorldMatrix(Transform t) |
||||||
|
{ |
||||||
|
return Matrix4x4.TRS(t.position, t.rotation, Vector3.one); |
||||||
|
} |
||||||
|
|
||||||
|
void AlignTransformToEndPoints(NavMeshLink navLink) |
||||||
|
{ |
||||||
|
var mat = UnscaledLocalToWorldMatrix(navLink.transform); |
||||||
|
|
||||||
|
var worldStartPt = mat.MultiplyPoint(navLink.startPoint); |
||||||
|
var worldEndPt = mat.MultiplyPoint(navLink.endPoint); |
||||||
|
|
||||||
|
var forward = worldEndPt - worldStartPt; |
||||||
|
var up = navLink.transform.up; |
||||||
|
|
||||||
|
// Flatten |
||||||
|
forward -= Vector3.Dot(up, forward) * up; |
||||||
|
|
||||||
|
var transform = navLink.transform; |
||||||
|
transform.rotation = Quaternion.LookRotation(forward, up); |
||||||
|
transform.position = (worldEndPt + worldStartPt) * 0.5f; |
||||||
|
transform.localScale = Vector3.one; |
||||||
|
|
||||||
|
navLink.startPoint = transform.InverseTransformPoint(worldStartPt); |
||||||
|
navLink.endPoint = transform.InverseTransformPoint(worldEndPt); |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnInspectorGUI() |
||||||
|
{ |
||||||
|
serializedObject.Update(); |
||||||
|
|
||||||
|
NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID); |
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_StartPoint); |
||||||
|
EditorGUILayout.PropertyField(m_EndPoint); |
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(); |
||||||
|
GUILayout.Space(EditorGUIUtility.labelWidth); |
||||||
|
if (GUILayout.Button("Swap")) |
||||||
|
{ |
||||||
|
foreach (NavMeshLink navLink in targets) |
||||||
|
{ |
||||||
|
var tmp = navLink.startPoint; |
||||||
|
navLink.startPoint = navLink.endPoint; |
||||||
|
navLink.endPoint = tmp; |
||||||
|
} |
||||||
|
SceneView.RepaintAll(); |
||||||
|
} |
||||||
|
if (GUILayout.Button("Align Transform")) |
||||||
|
{ |
||||||
|
foreach (NavMeshLink navLink in targets) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navLink.transform, "Align Transform to End Points"); |
||||||
|
Undo.RecordObject(navLink, "Align Transform to End Points"); |
||||||
|
AlignTransformToEndPoints(navLink); |
||||||
|
} |
||||||
|
SceneView.RepaintAll(); |
||||||
|
} |
||||||
|
GUILayout.EndHorizontal(); |
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_Width); |
||||||
|
EditorGUILayout.PropertyField(m_CostModifier); |
||||||
|
EditorGUILayout.PropertyField(m_AutoUpdatePosition); |
||||||
|
EditorGUILayout.PropertyField(m_Bidirectional); |
||||||
|
|
||||||
|
NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); |
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties(); |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
} |
||||||
|
|
||||||
|
static Vector3 CalcLinkRight(NavMeshLink navLink) |
||||||
|
{ |
||||||
|
var dir = navLink.endPoint - navLink.startPoint; |
||||||
|
return (new Vector3(-dir.z, 0.0f, dir.x)).normalized; |
||||||
|
} |
||||||
|
|
||||||
|
static void DrawLink(NavMeshLink navLink) |
||||||
|
{ |
||||||
|
var right = CalcLinkRight(navLink); |
||||||
|
var rad = navLink.width * 0.5f; |
||||||
|
|
||||||
|
Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.startPoint + right * rad); |
||||||
|
Gizmos.DrawLine(navLink.endPoint - right * rad, navLink.endPoint + right * rad); |
||||||
|
Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.endPoint - right * rad); |
||||||
|
Gizmos.DrawLine(navLink.startPoint + right * rad, navLink.endPoint + right * rad); |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)] |
||||||
|
static void RenderBoxGizmo(NavMeshLink navLink, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
if (!EditorApplication.isPlaying) |
||||||
|
navLink.UpdateLink(); |
||||||
|
|
||||||
|
var color = s_HandleColor; |
||||||
|
if (!navLink.enabled) |
||||||
|
color = s_HandleColorDisabled; |
||||||
|
|
||||||
|
var oldColor = Gizmos.color; |
||||||
|
var oldMatrix = Gizmos.matrix; |
||||||
|
|
||||||
|
Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform); |
||||||
|
|
||||||
|
Gizmos.color = color; |
||||||
|
DrawLink(navLink); |
||||||
|
|
||||||
|
Gizmos.matrix = oldMatrix; |
||||||
|
Gizmos.color = oldColor; |
||||||
|
|
||||||
|
Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] |
||||||
|
static void RenderBoxGizmoNotSelected(NavMeshLink navLink, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
if (NavMeshVisualizationSettings.showNavigation > 0) |
||||||
|
{ |
||||||
|
var color = s_HandleColor; |
||||||
|
if (!navLink.enabled) |
||||||
|
color = s_HandleColorDisabled; |
||||||
|
|
||||||
|
var oldColor = Gizmos.color; |
||||||
|
var oldMatrix = Gizmos.matrix; |
||||||
|
|
||||||
|
Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform); |
||||||
|
|
||||||
|
Gizmos.color = color; |
||||||
|
DrawLink(navLink); |
||||||
|
|
||||||
|
Gizmos.matrix = oldMatrix; |
||||||
|
Gizmos.color = oldColor; |
||||||
|
} |
||||||
|
|
||||||
|
Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
public void OnSceneGUI() |
||||||
|
{ |
||||||
|
var navLink = (NavMeshLink)target; |
||||||
|
if (!navLink.enabled) |
||||||
|
return; |
||||||
|
|
||||||
|
var mat = UnscaledLocalToWorldMatrix(navLink.transform); |
||||||
|
|
||||||
|
var startPt = mat.MultiplyPoint(navLink.startPoint); |
||||||
|
var endPt = mat.MultiplyPoint(navLink.endPoint); |
||||||
|
var midPt = Vector3.Lerp(startPt, endPt, 0.35f); |
||||||
|
var startSize = HandleUtility.GetHandleSize(startPt); |
||||||
|
var endSize = HandleUtility.GetHandleSize(endPt); |
||||||
|
var midSize = HandleUtility.GetHandleSize(midPt); |
||||||
|
|
||||||
|
var zup = Quaternion.FromToRotation(Vector3.forward, Vector3.up); |
||||||
|
var right = mat.MultiplyVector(CalcLinkRight(navLink)); |
||||||
|
|
||||||
|
var oldColor = Handles.color; |
||||||
|
Handles.color = s_HandleColor; |
||||||
|
|
||||||
|
Vector3 pos; |
||||||
|
|
||||||
|
if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 0) |
||||||
|
{ |
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
Handles.CubeHandleCap(0, startPt, zup, 0.1f * startSize, Event.current.type); |
||||||
|
pos = Handles.PositionHandle(startPt, navLink.transform.rotation); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navLink, "Move link point"); |
||||||
|
navLink.startPoint = mat.inverse.MultiplyPoint(pos); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (Handles.Button(startPt, zup, 0.1f * startSize, 0.1f * startSize, Handles.CubeHandleCap)) |
||||||
|
{ |
||||||
|
s_SelectedPoint = 0; |
||||||
|
s_SelectedID = navLink.GetInstanceID(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 1) |
||||||
|
{ |
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
Handles.CubeHandleCap(0, endPt, zup, 0.1f * startSize, Event.current.type); |
||||||
|
pos = Handles.PositionHandle(endPt, navLink.transform.rotation); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navLink, "Move link point"); |
||||||
|
navLink.endPoint = mat.inverse.MultiplyPoint(pos); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (Handles.Button(endPt, zup, 0.1f * endSize, 0.1f * endSize, Handles.CubeHandleCap)) |
||||||
|
{ |
||||||
|
s_SelectedPoint = 1; |
||||||
|
s_SelectedID = navLink.GetInstanceID(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
pos = Handles.Slider(midPt + right * navLink.width * 0.5f, right, midSize * 0.03f, Handles.DotHandleCap, 0); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navLink, "Adjust link width"); |
||||||
|
navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(right, (pos - midPt))); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
pos = Handles.Slider(midPt - right * navLink.width * 0.5f, -right, midSize * 0.03f, Handles.DotHandleCap, 0); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navLink, "Adjust link width"); |
||||||
|
navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(-right, (pos - midPt))); |
||||||
|
} |
||||||
|
|
||||||
|
Handles.color = oldColor; |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/AI/NavMesh Link", false, 2002)] |
||||||
|
static public void CreateNavMeshLink(MenuCommand menuCommand) |
||||||
|
{ |
||||||
|
var parent = menuCommand.context as GameObject; |
||||||
|
GameObject go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Link", parent); |
||||||
|
go.AddComponent<NavMeshLink>(); |
||||||
|
var view = SceneView.lastActiveSceneView; |
||||||
|
if (view != null) |
||||||
|
view.MoveToView(go.transform); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: ece1e865d1ad84587872fe8580ab5a20 |
||||||
|
timeCreated: 1477036743 |
||||||
|
licenseType: Pro |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,49 @@ |
|||||||
|
using UnityEngine.AI; |
||||||
|
|
||||||
|
namespace UnityEditor.AI |
||||||
|
{ |
||||||
|
[CanEditMultipleObjects] |
||||||
|
[CustomEditor(typeof(NavMeshModifier))] |
||||||
|
class NavMeshModifierEditor : Editor |
||||||
|
{ |
||||||
|
SerializedProperty m_AffectedAgents; |
||||||
|
SerializedProperty m_Area; |
||||||
|
SerializedProperty m_IgnoreFromBuild; |
||||||
|
SerializedProperty m_OverrideArea; |
||||||
|
|
||||||
|
void OnEnable() |
||||||
|
{ |
||||||
|
m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents"); |
||||||
|
m_Area = serializedObject.FindProperty("m_Area"); |
||||||
|
m_IgnoreFromBuild = serializedObject.FindProperty("m_IgnoreFromBuild"); |
||||||
|
m_OverrideArea = serializedObject.FindProperty("m_OverrideArea"); |
||||||
|
|
||||||
|
NavMeshVisualizationSettings.showNavigation++; |
||||||
|
} |
||||||
|
|
||||||
|
void OnDisable() |
||||||
|
{ |
||||||
|
NavMeshVisualizationSettings.showNavigation--; |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnInspectorGUI() |
||||||
|
{ |
||||||
|
serializedObject.Update(); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_IgnoreFromBuild); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_OverrideArea); |
||||||
|
if (m_OverrideArea.boolValue) |
||||||
|
{ |
||||||
|
EditorGUI.indentLevel++; |
||||||
|
NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); |
||||||
|
EditorGUI.indentLevel--; |
||||||
|
} |
||||||
|
|
||||||
|
NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents); |
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6fa04b4743e3947eba4d7b9e5832ea69 |
||||||
|
timeCreated: 1477036742 |
||||||
|
licenseType: Pro |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,154 @@ |
|||||||
|
using UnityEditor.IMGUI.Controls; |
||||||
|
using UnityEditorInternal; |
||||||
|
using UnityEngine.AI; |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace UnityEditor.AI |
||||||
|
{ |
||||||
|
[CanEditMultipleObjects] |
||||||
|
[CustomEditor(typeof(NavMeshModifierVolume))] |
||||||
|
class NavMeshModifierVolumeEditor : Editor |
||||||
|
{ |
||||||
|
SerializedProperty m_AffectedAgents; |
||||||
|
SerializedProperty m_Area; |
||||||
|
SerializedProperty m_Center; |
||||||
|
SerializedProperty m_Size; |
||||||
|
|
||||||
|
static Color s_HandleColor = new Color(187f, 138f, 240f, 210f) / 255; |
||||||
|
static Color s_HandleColorDisabled = new Color(187f * 0.75f, 138f * 0.75f, 240f * 0.75f, 100f) / 255; |
||||||
|
|
||||||
|
static int s_HandleControlIDHint = typeof(NavMeshModifierVolumeEditor).Name.GetHashCode(); |
||||||
|
BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle(s_HandleControlIDHint); |
||||||
|
|
||||||
|
bool editingCollider |
||||||
|
{ |
||||||
|
get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); } |
||||||
|
} |
||||||
|
|
||||||
|
void OnEnable() |
||||||
|
{ |
||||||
|
m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents"); |
||||||
|
m_Area = serializedObject.FindProperty("m_Area"); |
||||||
|
m_Center = serializedObject.FindProperty("m_Center"); |
||||||
|
m_Size = serializedObject.FindProperty("m_Size"); |
||||||
|
|
||||||
|
NavMeshVisualizationSettings.showNavigation++; |
||||||
|
} |
||||||
|
|
||||||
|
void OnDisable() |
||||||
|
{ |
||||||
|
NavMeshVisualizationSettings.showNavigation--; |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnInspectorGUI() |
||||||
|
{ |
||||||
|
serializedObject.Update(); |
||||||
|
|
||||||
|
InspectorEditButtonGUI(); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_Size); |
||||||
|
EditorGUILayout.PropertyField(m_Center); |
||||||
|
|
||||||
|
NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); |
||||||
|
NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents); |
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties(); |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.Selected | GizmoType.Active)] |
||||||
|
static void RenderBoxGizmo(NavMeshModifierVolume navModifier, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled; |
||||||
|
var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f); |
||||||
|
|
||||||
|
var oldColor = Gizmos.color; |
||||||
|
var oldMatrix = Gizmos.matrix; |
||||||
|
|
||||||
|
Gizmos.matrix = navModifier.transform.localToWorldMatrix; |
||||||
|
|
||||||
|
Gizmos.color = colorTrans; |
||||||
|
Gizmos.DrawCube(navModifier.center, navModifier.size); |
||||||
|
|
||||||
|
Gizmos.color = color; |
||||||
|
Gizmos.DrawWireCube(navModifier.center, navModifier.size); |
||||||
|
|
||||||
|
Gizmos.matrix = oldMatrix; |
||||||
|
Gizmos.color = oldColor; |
||||||
|
|
||||||
|
Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] |
||||||
|
static void RenderBoxGizmoNotSelected(NavMeshModifierVolume navModifier, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
if (NavMeshVisualizationSettings.showNavigation > 0) |
||||||
|
{ |
||||||
|
var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled; |
||||||
|
var oldColor = Gizmos.color; |
||||||
|
var oldMatrix = Gizmos.matrix; |
||||||
|
|
||||||
|
Gizmos.matrix = navModifier.transform.localToWorldMatrix; |
||||||
|
|
||||||
|
Gizmos.color = color; |
||||||
|
Gizmos.DrawWireCube(navModifier.center, navModifier.size); |
||||||
|
|
||||||
|
Gizmos.matrix = oldMatrix; |
||||||
|
Gizmos.color = oldColor; |
||||||
|
} |
||||||
|
|
||||||
|
Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
void InspectorEditButtonGUI() |
||||||
|
{ |
||||||
|
var navModifier = (NavMeshModifierVolume)target; |
||||||
|
var bounds = new Bounds(navModifier.transform.position, navModifier.size); |
||||||
|
|
||||||
|
EditMode.DoEditModeInspectorModeButton( |
||||||
|
EditMode.SceneViewEditMode.Collider, |
||||||
|
"Edit Volume", |
||||||
|
EditorGUIUtility.IconContent("EditCollider"), |
||||||
|
bounds, |
||||||
|
this |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
void OnSceneGUI() |
||||||
|
{ |
||||||
|
if (!editingCollider) |
||||||
|
return; |
||||||
|
|
||||||
|
var vol = (NavMeshModifierVolume)target; |
||||||
|
var color = vol.enabled ? s_HandleColor : s_HandleColorDisabled; |
||||||
|
using (new Handles.DrawingScope(color, vol.transform.localToWorldMatrix)) |
||||||
|
{ |
||||||
|
m_BoundsHandle.center = vol.center; |
||||||
|
m_BoundsHandle.size = vol.size; |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
m_BoundsHandle.DrawHandle(); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(vol, "Modified NavMesh Modifier Volume"); |
||||||
|
Vector3 center = m_BoundsHandle.center; |
||||||
|
Vector3 size = m_BoundsHandle.size; |
||||||
|
vol.center = center; |
||||||
|
vol.size = size; |
||||||
|
EditorUtility.SetDirty(target); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/AI/NavMesh Modifier Volume", false, 2001)] |
||||||
|
static public void CreateNavMeshModifierVolume(MenuCommand menuCommand) |
||||||
|
{ |
||||||
|
var parent = menuCommand.context as GameObject; |
||||||
|
var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Modifier Volume", parent); |
||||||
|
go.AddComponent<NavMeshModifierVolume>(); |
||||||
|
var view = SceneView.lastActiveSceneView; |
||||||
|
if (view != null) |
||||||
|
view.MoveToView(go.transform); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c0f3bef2a67ae4e139538afec3e59b03 |
||||||
|
timeCreated: 1477036743 |
||||||
|
licenseType: Pro |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,490 @@ |
|||||||
|
using System.Collections.Generic; |
||||||
|
using System.IO; |
||||||
|
using System.Linq; |
||||||
|
using UnityEditor.IMGUI.Controls; |
||||||
|
using UnityEditor.SceneManagement; |
||||||
|
using UnityEditorInternal; |
||||||
|
using UnityEngine.AI; |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace UnityEditor.AI |
||||||
|
{ |
||||||
|
[CanEditMultipleObjects] |
||||||
|
[CustomEditor(typeof(NavMeshSurface))] |
||||||
|
class NavMeshSurfaceEditor : Editor |
||||||
|
{ |
||||||
|
SerializedProperty m_AgentTypeID; |
||||||
|
SerializedProperty m_BuildHeightMesh; |
||||||
|
SerializedProperty m_Center; |
||||||
|
SerializedProperty m_CollectObjects; |
||||||
|
SerializedProperty m_DefaultArea; |
||||||
|
SerializedProperty m_LayerMask; |
||||||
|
SerializedProperty m_OverrideTileSize; |
||||||
|
SerializedProperty m_OverrideVoxelSize; |
||||||
|
SerializedProperty m_Size; |
||||||
|
SerializedProperty m_TileSize; |
||||||
|
SerializedProperty m_UseGeometry; |
||||||
|
SerializedProperty m_VoxelSize; |
||||||
|
|
||||||
|
class Styles |
||||||
|
{ |
||||||
|
public readonly GUIContent m_LayerMask = new GUIContent("Include Layers"); |
||||||
|
|
||||||
|
public readonly GUIContent m_ShowInputGeom = new GUIContent("Show Input Geom"); |
||||||
|
public readonly GUIContent m_ShowVoxels = new GUIContent("Show Voxels"); |
||||||
|
public readonly GUIContent m_ShowRegions = new GUIContent("Show Regions"); |
||||||
|
public readonly GUIContent m_ShowRawContours = new GUIContent("Show Raw Contours"); |
||||||
|
public readonly GUIContent m_ShowContours = new GUIContent("Show Contours"); |
||||||
|
public readonly GUIContent m_ShowPolyMesh = new GUIContent("Show Poly Mesh"); |
||||||
|
public readonly GUIContent m_ShowPolyMeshDetail = new GUIContent("Show Poly Mesh Detail"); |
||||||
|
} |
||||||
|
|
||||||
|
struct AsyncBakeOperation |
||||||
|
{ |
||||||
|
public NavMeshSurface surface; |
||||||
|
public NavMeshData bakeData; |
||||||
|
public AsyncOperation bakeOperation; |
||||||
|
} |
||||||
|
|
||||||
|
static List<AsyncBakeOperation> s_BakeOperations = new List<AsyncBakeOperation>(); |
||||||
|
|
||||||
|
static Styles s_Styles; |
||||||
|
|
||||||
|
static bool s_ShowDebugOptions; |
||||||
|
|
||||||
|
static Color s_HandleColor = new Color(127f, 214f, 244f, 100f) / 255; |
||||||
|
static Color s_HandleColorSelected = new Color(127f, 214f, 244f, 210f) / 255; |
||||||
|
static Color s_HandleColorDisabled = new Color(127f * 0.75f, 214f * 0.75f, 244f * 0.75f, 100f) / 255; |
||||||
|
|
||||||
|
static int s_HandleControlIDHint = typeof(NavMeshSurfaceEditor).Name.GetHashCode(); |
||||||
|
BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle(s_HandleControlIDHint); |
||||||
|
|
||||||
|
bool editingCollider |
||||||
|
{ |
||||||
|
get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); } |
||||||
|
} |
||||||
|
|
||||||
|
void OnEnable() |
||||||
|
{ |
||||||
|
m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID"); |
||||||
|
m_BuildHeightMesh = serializedObject.FindProperty("m_BuildHeightMesh"); |
||||||
|
m_Center = serializedObject.FindProperty("m_Center"); |
||||||
|
m_CollectObjects = serializedObject.FindProperty("m_CollectObjects"); |
||||||
|
m_DefaultArea = serializedObject.FindProperty("m_DefaultArea"); |
||||||
|
m_LayerMask = serializedObject.FindProperty("m_LayerMask"); |
||||||
|
m_OverrideTileSize = serializedObject.FindProperty("m_OverrideTileSize"); |
||||||
|
m_OverrideVoxelSize = serializedObject.FindProperty("m_OverrideVoxelSize"); |
||||||
|
m_Size = serializedObject.FindProperty("m_Size"); |
||||||
|
m_TileSize = serializedObject.FindProperty("m_TileSize"); |
||||||
|
m_UseGeometry = serializedObject.FindProperty("m_UseGeometry"); |
||||||
|
m_VoxelSize = serializedObject.FindProperty("m_VoxelSize"); |
||||||
|
|
||||||
|
NavMeshVisualizationSettings.showNavigation++; |
||||||
|
} |
||||||
|
|
||||||
|
void OnDisable() |
||||||
|
{ |
||||||
|
NavMeshVisualizationSettings.showNavigation--; |
||||||
|
} |
||||||
|
|
||||||
|
static string GetAndEnsureTargetPath(NavMeshSurface surface) |
||||||
|
{ |
||||||
|
// Create directory for the asset if it does not exist yet. |
||||||
|
var activeScenePath = surface.gameObject.scene.path; |
||||||
|
|
||||||
|
var targetPath = "Assets"; |
||||||
|
if (!string.IsNullOrEmpty(activeScenePath)) |
||||||
|
targetPath = Path.Combine(Path.GetDirectoryName(activeScenePath), Path.GetFileNameWithoutExtension(activeScenePath)); |
||||||
|
if (!Directory.Exists(targetPath)) |
||||||
|
Directory.CreateDirectory(targetPath); |
||||||
|
return targetPath; |
||||||
|
} |
||||||
|
|
||||||
|
static void CreateNavMeshAsset(NavMeshSurface surface) |
||||||
|
{ |
||||||
|
var targetPath = GetAndEnsureTargetPath(surface); |
||||||
|
|
||||||
|
var combinedAssetPath = Path.Combine(targetPath, "NavMesh-" + surface.name + ".asset"); |
||||||
|
combinedAssetPath = AssetDatabase.GenerateUniqueAssetPath(combinedAssetPath); |
||||||
|
AssetDatabase.CreateAsset(surface.navMeshData, combinedAssetPath); |
||||||
|
} |
||||||
|
|
||||||
|
static NavMeshData GetNavMeshAssetToDelete(NavMeshSurface navSurface) |
||||||
|
{ |
||||||
|
var prefabType = PrefabUtility.GetPrefabType(navSurface); |
||||||
|
if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) |
||||||
|
{ |
||||||
|
// Don't allow deleting the asset belonging to the prefab parent |
||||||
|
var parentSurface = PrefabUtility.GetPrefabParent(navSurface) as NavMeshSurface; |
||||||
|
if (parentSurface && navSurface.navMeshData == parentSurface.navMeshData) |
||||||
|
return null; |
||||||
|
} |
||||||
|
return navSurface.navMeshData; |
||||||
|
} |
||||||
|
|
||||||
|
void ClearSurface(NavMeshSurface navSurface) |
||||||
|
{ |
||||||
|
var assetToDelete = GetNavMeshAssetToDelete(navSurface); |
||||||
|
navSurface.RemoveData(); |
||||||
|
navSurface.navMeshData = null; |
||||||
|
EditorUtility.SetDirty(navSurface); |
||||||
|
|
||||||
|
if (assetToDelete) |
||||||
|
{ |
||||||
|
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assetToDelete)); |
||||||
|
EditorSceneManager.MarkSceneDirty(navSurface.gameObject.scene); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnInspectorGUI() |
||||||
|
{ |
||||||
|
if (s_Styles == null) |
||||||
|
s_Styles = new Styles(); |
||||||
|
|
||||||
|
serializedObject.Update(); |
||||||
|
|
||||||
|
var bs = NavMesh.GetSettingsByID(m_AgentTypeID.intValue); |
||||||
|
|
||||||
|
if (bs.agentTypeID != -1) |
||||||
|
{ |
||||||
|
// Draw image |
||||||
|
const float diagramHeight = 80.0f; |
||||||
|
Rect agentDiagramRect = EditorGUILayout.GetControlRect(false, diagramHeight); |
||||||
|
NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, bs.agentRadius, bs.agentHeight, bs.agentClimb, bs.agentSlope); |
||||||
|
} |
||||||
|
NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID); |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_CollectObjects); |
||||||
|
if ((CollectObjects)m_CollectObjects.enumValueIndex == CollectObjects.Volume) |
||||||
|
{ |
||||||
|
EditorGUI.indentLevel++; |
||||||
|
InspectorEditButtonGUI(); |
||||||
|
EditorGUILayout.PropertyField(m_Size); |
||||||
|
EditorGUILayout.PropertyField(m_Center); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (editingCollider) |
||||||
|
EditMode.QuitEditMode(); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_LayerMask, s_Styles.m_LayerMask); |
||||||
|
EditorGUILayout.PropertyField(m_UseGeometry); |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
m_OverrideVoxelSize.isExpanded = EditorGUILayout.Foldout(m_OverrideVoxelSize.isExpanded, "Advanced"); |
||||||
|
if (m_OverrideVoxelSize.isExpanded) |
||||||
|
{ |
||||||
|
EditorGUI.indentLevel++; |
||||||
|
|
||||||
|
NavMeshComponentsGUIUtility.AreaPopup("Default Area", m_DefaultArea); |
||||||
|
|
||||||
|
// Override voxel size. |
||||||
|
EditorGUILayout.PropertyField(m_OverrideVoxelSize); |
||||||
|
|
||||||
|
using (new EditorGUI.DisabledScope(!m_OverrideVoxelSize.boolValue || m_OverrideVoxelSize.hasMultipleDifferentValues)) |
||||||
|
{ |
||||||
|
EditorGUI.indentLevel++; |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_VoxelSize); |
||||||
|
|
||||||
|
if (!m_OverrideVoxelSize.hasMultipleDifferentValues) |
||||||
|
{ |
||||||
|
if (!m_AgentTypeID.hasMultipleDifferentValues) |
||||||
|
{ |
||||||
|
float voxelsPerRadius = m_VoxelSize.floatValue > 0.0f ? (bs.agentRadius / m_VoxelSize.floatValue) : 0.0f; |
||||||
|
EditorGUILayout.LabelField(" ", voxelsPerRadius.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel); |
||||||
|
} |
||||||
|
if (m_OverrideVoxelSize.boolValue) |
||||||
|
EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None); |
||||||
|
} |
||||||
|
EditorGUI.indentLevel--; |
||||||
|
} |
||||||
|
|
||||||
|
// Override tile size |
||||||
|
EditorGUILayout.PropertyField(m_OverrideTileSize); |
||||||
|
|
||||||
|
using (new EditorGUI.DisabledScope(!m_OverrideTileSize.boolValue || m_OverrideTileSize.hasMultipleDifferentValues)) |
||||||
|
{ |
||||||
|
EditorGUI.indentLevel++; |
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(m_TileSize); |
||||||
|
|
||||||
|
if (!m_TileSize.hasMultipleDifferentValues && !m_VoxelSize.hasMultipleDifferentValues) |
||||||
|
{ |
||||||
|
float tileWorldSize = m_TileSize.intValue * m_VoxelSize.floatValue; |
||||||
|
EditorGUILayout.LabelField(" ", tileWorldSize.ToString("0.00") + " world units", EditorStyles.miniLabel); |
||||||
|
} |
||||||
|
|
||||||
|
if (!m_OverrideTileSize.hasMultipleDifferentValues) |
||||||
|
{ |
||||||
|
if (m_OverrideTileSize.boolValue) |
||||||
|
EditorGUILayout.HelpBox("Tile size controls the how local the changes to the world are (rebuild or carve). Small tile size allows more local changes, while potentially generating more data in overal.", MessageType.None); |
||||||
|
} |
||||||
|
EditorGUI.indentLevel--; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// Height mesh |
||||||
|
using (new EditorGUI.DisabledScope(true)) |
||||||
|
{ |
||||||
|
EditorGUILayout.PropertyField(m_BuildHeightMesh); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
EditorGUI.indentLevel--; |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties(); |
||||||
|
|
||||||
|
var hadError = false; |
||||||
|
var multipleTargets = targets.Length > 1; |
||||||
|
foreach (NavMeshSurface navSurface in targets) |
||||||
|
{ |
||||||
|
var settings = navSurface.GetBuildSettings(); |
||||||
|
// Calculating bounds is potentially expensive when unbounded - so here we just use the center/size. |
||||||
|
// It means the validation is not checking vertical voxel limit correctly when the surface is set to something else than "in volume". |
||||||
|
var bounds = new Bounds(Vector3.zero, Vector3.zero); |
||||||
|
if (navSurface.collectObjects == CollectObjects.Volume) |
||||||
|
{ |
||||||
|
bounds = new Bounds(navSurface.center, navSurface.size); |
||||||
|
} |
||||||
|
|
||||||
|
var errors = settings.ValidationReport(bounds); |
||||||
|
if (errors.Length > 0) |
||||||
|
{ |
||||||
|
if (multipleTargets) |
||||||
|
EditorGUILayout.LabelField(navSurface.name); |
||||||
|
foreach (var err in errors) |
||||||
|
{ |
||||||
|
EditorGUILayout.HelpBox(err, MessageType.Warning); |
||||||
|
} |
||||||
|
GUILayout.BeginHorizontal(); |
||||||
|
GUILayout.Space(EditorGUIUtility.labelWidth); |
||||||
|
if (GUILayout.Button("Open Agent Settings...", EditorStyles.miniButton)) |
||||||
|
NavMeshEditorHelpers.OpenAgentSettings(navSurface.agentTypeID); |
||||||
|
GUILayout.EndHorizontal(); |
||||||
|
hadError = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (hadError) |
||||||
|
EditorGUILayout.Space(); |
||||||
|
|
||||||
|
using (new EditorGUI.DisabledScope(Application.isPlaying || m_AgentTypeID.intValue == -1)) |
||||||
|
{ |
||||||
|
GUILayout.BeginHorizontal(); |
||||||
|
GUILayout.Space(EditorGUIUtility.labelWidth); |
||||||
|
if (GUILayout.Button("Clear")) |
||||||
|
{ |
||||||
|
foreach (NavMeshSurface s in targets) |
||||||
|
ClearSurface(s); |
||||||
|
SceneView.RepaintAll(); |
||||||
|
} |
||||||
|
|
||||||
|
if (GUILayout.Button("Bake")) |
||||||
|
{ |
||||||
|
// Remove first to avoid double registration of the callback |
||||||
|
EditorApplication.update -= UpdateAsyncBuildOperations; |
||||||
|
EditorApplication.update += UpdateAsyncBuildOperations; |
||||||
|
|
||||||
|
foreach (NavMeshSurface surf in targets) |
||||||
|
{ |
||||||
|
var oper = new AsyncBakeOperation(); |
||||||
|
|
||||||
|
oper.bakeData = InitializeBakeData(surf); |
||||||
|
oper.bakeOperation = surf.UpdateNavMesh(oper.bakeData); |
||||||
|
oper.surface = surf; |
||||||
|
|
||||||
|
s_BakeOperations.Add(oper); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
GUILayout.EndHorizontal(); |
||||||
|
} |
||||||
|
|
||||||
|
// Show progress for the selected targets |
||||||
|
for (int i = s_BakeOperations.Count - 1; i >= 0; --i) |
||||||
|
{ |
||||||
|
if (!targets.Contains(s_BakeOperations[i].surface)) |
||||||
|
continue; |
||||||
|
|
||||||
|
var oper = s_BakeOperations[i].bakeOperation; |
||||||
|
if (oper == null) |
||||||
|
continue; |
||||||
|
|
||||||
|
var p = oper.progress; |
||||||
|
if (oper.isDone) |
||||||
|
{ |
||||||
|
SceneView.RepaintAll(); |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(); |
||||||
|
|
||||||
|
if (GUILayout.Button("Cancel", EditorStyles.miniButton)) |
||||||
|
{ |
||||||
|
var bakeData = s_BakeOperations[i].bakeData; |
||||||
|
UnityEngine.AI.NavMeshBuilder.Cancel(bakeData); |
||||||
|
s_BakeOperations.RemoveAt(i); |
||||||
|
} |
||||||
|
|
||||||
|
EditorGUI.ProgressBar(EditorGUILayout.GetControlRect(), p, "Baking: " + (int)(100 * p) + "%"); |
||||||
|
if (p <= 1) |
||||||
|
Repaint(); |
||||||
|
|
||||||
|
GUILayout.EndHorizontal(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static NavMeshData InitializeBakeData(NavMeshSurface surface) |
||||||
|
{ |
||||||
|
var emptySources = new List<NavMeshBuildSource>(); |
||||||
|
var emptyBounds = new Bounds(); |
||||||
|
return UnityEngine.AI.NavMeshBuilder.BuildNavMeshData(surface.GetBuildSettings(), emptySources, emptyBounds |
||||||
|
, surface.transform.position, surface.transform.rotation); |
||||||
|
} |
||||||
|
|
||||||
|
static void UpdateAsyncBuildOperations() |
||||||
|
{ |
||||||
|
foreach (var oper in s_BakeOperations) |
||||||
|
{ |
||||||
|
if (oper.surface == null || oper.bakeOperation == null) |
||||||
|
continue; |
||||||
|
|
||||||
|
if (oper.bakeOperation.isDone) |
||||||
|
{ |
||||||
|
var surface = oper.surface; |
||||||
|
var delete = GetNavMeshAssetToDelete(surface); |
||||||
|
if (delete != null) |
||||||
|
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(delete)); |
||||||
|
|
||||||
|
surface.RemoveData(); |
||||||
|
surface.navMeshData = oper.bakeData; |
||||||
|
if (surface.isActiveAndEnabled) |
||||||
|
surface.AddData(); |
||||||
|
CreateNavMeshAsset(surface); |
||||||
|
EditorSceneManager.MarkSceneDirty(surface.gameObject.scene); |
||||||
|
} |
||||||
|
} |
||||||
|
s_BakeOperations.RemoveAll(o => o.bakeOperation == null || o.bakeOperation.isDone); |
||||||
|
if (s_BakeOperations.Count == 0) |
||||||
|
EditorApplication.update -= UpdateAsyncBuildOperations; |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)] |
||||||
|
static void RenderBoxGizmoSelected(NavMeshSurface navSurface, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
RenderBoxGizmo(navSurface, gizmoType, true); |
||||||
|
} |
||||||
|
|
||||||
|
[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] |
||||||
|
static void RenderBoxGizmoNotSelected(NavMeshSurface navSurface, GizmoType gizmoType) |
||||||
|
{ |
||||||
|
if (NavMeshVisualizationSettings.showNavigation > 0) |
||||||
|
RenderBoxGizmo(navSurface, gizmoType, false); |
||||||
|
else |
||||||
|
Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
static void RenderBoxGizmo(NavMeshSurface navSurface, GizmoType gizmoType, bool selected) |
||||||
|
{ |
||||||
|
var color = selected ? s_HandleColorSelected : s_HandleColor; |
||||||
|
if (!navSurface.enabled) |
||||||
|
color = s_HandleColorDisabled; |
||||||
|
|
||||||
|
var oldColor = Gizmos.color; |
||||||
|
var oldMatrix = Gizmos.matrix; |
||||||
|
|
||||||
|
// Use the unscaled matrix for the NavMeshSurface |
||||||
|
var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one); |
||||||
|
Gizmos.matrix = localToWorld; |
||||||
|
|
||||||
|
if (navSurface.collectObjects == CollectObjects.Volume) |
||||||
|
{ |
||||||
|
Gizmos.color = color; |
||||||
|
Gizmos.DrawWireCube(navSurface.center, navSurface.size); |
||||||
|
|
||||||
|
if (selected && navSurface.enabled) |
||||||
|
{ |
||||||
|
var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f); |
||||||
|
Gizmos.color = colorTrans; |
||||||
|
Gizmos.DrawCube(navSurface.center, navSurface.size); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (navSurface.navMeshData != null) |
||||||
|
{ |
||||||
|
var bounds = navSurface.navMeshData.sourceBounds; |
||||||
|
Gizmos.color = Color.grey; |
||||||
|
Gizmos.DrawWireCube(bounds.center, bounds.size); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Gizmos.matrix = oldMatrix; |
||||||
|
Gizmos.color = oldColor; |
||||||
|
|
||||||
|
Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true); |
||||||
|
} |
||||||
|
|
||||||
|
void InspectorEditButtonGUI() |
||||||
|
{ |
||||||
|
var navSurface = (NavMeshSurface)target; |
||||||
|
var bounds = new Bounds(navSurface.transform.position, navSurface.size); |
||||||
|
|
||||||
|
EditMode.DoEditModeInspectorModeButton( |
||||||
|
EditMode.SceneViewEditMode.Collider, |
||||||
|
"Edit Volume", |
||||||
|
EditorGUIUtility.IconContent("EditCollider"), |
||||||
|
bounds, |
||||||
|
this |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
void OnSceneGUI() |
||||||
|
{ |
||||||
|
if (!editingCollider) |
||||||
|
return; |
||||||
|
|
||||||
|
var navSurface = (NavMeshSurface)target; |
||||||
|
var color = navSurface.enabled ? s_HandleColor : s_HandleColorDisabled; |
||||||
|
var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one); |
||||||
|
using (new Handles.DrawingScope(color, localToWorld)) |
||||||
|
{ |
||||||
|
m_BoundsHandle.center = navSurface.center; |
||||||
|
m_BoundsHandle.size = navSurface.size; |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
m_BoundsHandle.DrawHandle(); |
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(navSurface, "Modified NavMesh Surface"); |
||||||
|
Vector3 center = m_BoundsHandle.center; |
||||||
|
Vector3 size = m_BoundsHandle.size; |
||||||
|
navSurface.center = center; |
||||||
|
navSurface.size = size; |
||||||
|
EditorUtility.SetDirty(target); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/AI/NavMesh Surface", false, 2000)] |
||||||
|
public static void CreateNavMeshSurface(MenuCommand menuCommand) |
||||||
|
{ |
||||||
|
var parent = menuCommand.context as GameObject; |
||||||
|
var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Surface", parent); |
||||||
|
go.AddComponent<NavMeshSurface>(); |
||||||
|
var view = SceneView.lastActiveSceneView; |
||||||
|
if (view != null) |
||||||
|
view.MoveToView(go.transform); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1c32167dbf3314852b6006a288eb449b |
||||||
|
timeCreated: 1476968447 |
||||||
|
licenseType: Pro |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue