Skip to content

Commit 632cbee

Browse files
committed
SightSensor and SightTraigger finish
1 parent 40d73b2 commit 632cbee

14 files changed

+355
-14
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1001 &100100000
4+
Prefab:
5+
m_ObjectHideFlags: 1
6+
serializedVersion: 2
7+
m_Modification:
8+
m_TransformParent: {fileID: 0}
9+
m_Modifications: []
10+
m_RemovedComponents: []
11+
m_ParentPrefab: {fileID: 0}
12+
m_RootGameObject: {fileID: 1098180382252310}
13+
m_IsPrefabParent: 1
14+
--- !u!1 &1098180382252310
15+
GameObject:
16+
m_ObjectHideFlags: 0
17+
m_PrefabParentObject: {fileID: 0}
18+
m_PrefabInternal: {fileID: 100100000}
19+
serializedVersion: 5
20+
m_Component:
21+
- component: {fileID: 4667385588141414}
22+
- component: {fileID: 114687080641412072}
23+
m_Layer: 0
24+
m_Name: GameManager
25+
m_TagString: Untagged
26+
m_Icon: {fileID: 0}
27+
m_NavMeshLayer: 0
28+
m_StaticEditorFlags: 0
29+
m_IsActive: 1
30+
--- !u!4 &4667385588141414
31+
Transform:
32+
m_ObjectHideFlags: 1
33+
m_PrefabParentObject: {fileID: 0}
34+
m_PrefabInternal: {fileID: 100100000}
35+
m_GameObject: {fileID: 1098180382252310}
36+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
37+
m_LocalPosition: {x: 4.106417, y: 1.0989422, z: -3.295022}
38+
m_LocalScale: {x: 1, y: 1, z: 1}
39+
m_Children: []
40+
m_Father: {fileID: 0}
41+
m_RootOrder: 0
42+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
43+
--- !u!114 &114687080641412072
44+
MonoBehaviour:
45+
m_ObjectHideFlags: 1
46+
m_PrefabParentObject: {fileID: 0}
47+
m_PrefabInternal: {fileID: 100100000}
48+
m_GameObject: {fileID: 1098180382252310}
49+
m_Enabled: 1
50+
m_EditorHideFlags: 0
51+
m_Script: {fileID: 11500000, guid: 175bbcaa0f0b7df4db2f4114c204bd05, type: 3}
52+
m_Name:
53+
m_EditorClassIdentifier:

Assets/Prefab/08-PerceptualSystem/GameManager.prefab.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Prefab/08-PerceptualSystem/Plane.prefab

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Transform:
181181
m_GameObject: {fileID: 1970713654626978}
182182
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
183183
m_LocalPosition: {x: -0.05, y: 0.6, z: -4.7}
184-
m_LocalScale: {x: 9.55211, y: 1, z: 0.19418}
184+
m_LocalScale: {x: 9.55211, y: 5.77, z: 0.19418}
185185
m_Children: []
186186
m_Father: {fileID: 4318411361551580}
187187
m_RootOrder: 5
@@ -215,7 +215,7 @@ Transform:
215215
m_GameObject: {fileID: 1330871429028086}
216216
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
217217
m_LocalPosition: {x: 0, y: 0.6, z: 2.53}
218-
m_LocalScale: {x: 4.9123125, y: 1, z: 0.19418493}
218+
m_LocalScale: {x: 4.9123125, y: 5.77, z: 0.19418493}
219219
m_Children: []
220220
m_Father: {fileID: 4318411361551580}
221221
m_RootOrder: 0
@@ -228,7 +228,7 @@ Transform:
228228
m_GameObject: {fileID: 1344498054626816}
229229
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
230230
m_LocalPosition: {x: 2.63, y: 0.6, z: -2.78}
231-
m_LocalScale: {x: 4.0130534, y: 1, z: 0.19418493}
231+
m_LocalScale: {x: 4.0130534, y: 5.77, z: 0.19418493}
232232
m_Children: []
233233
m_Father: {fileID: 4318411361551580}
234234
m_RootOrder: 1
@@ -241,7 +241,7 @@ Transform:
241241
m_GameObject: {fileID: 1289411518359044}
242242
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
243243
m_LocalPosition: {x: 0.1, y: 0.6, z: 4.89}
244-
m_LocalScale: {x: 9.552114, y: 1, z: 0.19418}
244+
m_LocalScale: {x: 9.552114, y: 5.77, z: 0.19418}
245245
m_Children: []
246246
m_Father: {fileID: 4318411361551580}
247247
m_RootOrder: 4
@@ -254,7 +254,7 @@ Transform:
254254
m_GameObject: {fileID: 1979892004053096}
255255
m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068}
256256
m_LocalPosition: {x: 4.75, y: 0.55, z: 0.06}
257-
m_LocalScale: {x: 9.552114, y: 1, z: 0.19418012}
257+
m_LocalScale: {x: 9.552114, y: 5.77, z: 0.19418012}
258258
m_Children: []
259259
m_Father: {fileID: 4318411361551580}
260260
m_RootOrder: 7
@@ -267,7 +267,7 @@ Transform:
267267
m_GameObject: {fileID: 1499741162318718}
268268
m_LocalRotation: {x: -0.008421865, y: -0.7253375, z: -0.020072589, w: 0.68804926}
269269
m_LocalPosition: {x: -2.25, y: 0.6, z: 1}
270-
m_LocalScale: {x: 3.2366154, y: 1, z: 0.19418499}
270+
m_LocalScale: {x: 3.2366154, y: 5.77, z: 0.19418499}
271271
m_Children: []
272272
m_Father: {fileID: 4318411361551580}
273273
m_RootOrder: 3
@@ -280,7 +280,7 @@ Transform:
280280
m_GameObject: {fileID: 1389894417397840}
281281
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
282282
m_LocalPosition: {x: -4.67, y: 0.6, z: -0}
283-
m_LocalScale: {x: 9.55211, y: 1, z: 0.19418}
283+
m_LocalScale: {x: 9.55211, y: 5.77, z: 0.19418}
284284
m_Children: []
285285
m_Father: {fileID: 4318411361551580}
286286
m_RootOrder: 6
@@ -293,7 +293,7 @@ Transform:
293293
m_GameObject: {fileID: 1722620188148854}
294294
m_LocalRotation: {x: -0, y: -0.51777285, z: -0, w: 0.8555182}
295295
m_LocalPosition: {x: 3.02, y: 0.6, z: -1.35}
296-
m_LocalScale: {x: 3.2366154, y: 1, z: 0.19418499}
296+
m_LocalScale: {x: 3.2366154, y: 5.77, z: 0.19418499}
297297
m_Children: []
298298
m_Father: {fileID: 4318411361551580}
299299
m_RootOrder: 2

Assets/Prefab/08-PerceptualSystem/Zombie.prefab

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ GameObject:
223223
- component: {fileID: 95563371354119556}
224224
- component: {fileID: 114444493251915094}
225225
- component: {fileID: 136657370711253662}
226+
- component: {fileID: 54299784005585486}
227+
- component: {fileID: 33944642234920852}
226228
m_Layer: 0
227229
m_Name: Zombie
228230
m_TagString: Untagged
@@ -460,6 +462,24 @@ GameObject:
460462
m_NavMeshLayer: 0
461463
m_StaticEditorFlags: 0
462464
m_IsActive: 1
465+
--- !u!1 &1643353808705120
466+
GameObject:
467+
m_ObjectHideFlags: 0
468+
m_PrefabParentObject: {fileID: 0}
469+
m_PrefabInternal: {fileID: 100100000}
470+
serializedVersion: 5
471+
m_Component:
472+
- component: {fileID: 4376024341038532}
473+
- component: {fileID: 33727839429478732}
474+
- component: {fileID: 64143605779186180}
475+
- component: {fileID: 23234407771938346}
476+
m_Layer: 0
477+
m_Name: sector
478+
m_TagString: Untagged
479+
m_Icon: {fileID: 0}
480+
m_NavMeshLayer: 0
481+
m_StaticEditorFlags: 0
482+
m_IsActive: 0
463483
--- !u!1 &1679534170975238
464484
GameObject:
465485
m_ObjectHideFlags: 1
@@ -679,7 +699,7 @@ Transform:
679699
m_PrefabInternal: {fileID: 100100000}
680700
m_GameObject: {fileID: 1343502948497016}
681701
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
682-
m_LocalPosition: {x: 0, y: 0, z: 0}
702+
m_LocalPosition: {x: 0, y: 0, z: -3.21}
683703
m_LocalScale: {x: 1, y: 1, z: 1}
684704
m_Children:
685705
- {fileID: 4256225226556532}
@@ -700,6 +720,7 @@ Transform:
700720
- {fileID: 4200713715811060}
701721
- {fileID: 4252768117999244}
702722
- {fileID: 4176095369760310}
723+
- {fileID: 4376024341038532}
703724
m_Father: {fileID: 0}
704725
m_RootOrder: 0
705726
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -822,6 +843,19 @@ Transform:
822843
m_Father: {fileID: 4846626414520490}
823844
m_RootOrder: 1
824845
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
846+
--- !u!4 &4376024341038532
847+
Transform:
848+
m_ObjectHideFlags: 1
849+
m_PrefabParentObject: {fileID: 0}
850+
m_PrefabInternal: {fileID: 100100000}
851+
m_GameObject: {fileID: 1643353808705120}
852+
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
853+
m_LocalPosition: {x: 0, y: 0, z: 0}
854+
m_LocalScale: {x: 1, y: 1, z: 1}
855+
m_Children: []
856+
m_Father: {fileID: 4017170931754302}
857+
m_RootOrder: 18
858+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
825859
--- !u!4 &4388602057009262
826860
Transform:
827861
m_ObjectHideFlags: 1
@@ -1220,6 +1254,83 @@ Transform:
12201254
m_Father: {fileID: 4017170931754302}
12211255
m_RootOrder: 1
12221256
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1257+
--- !u!23 &23234407771938346
1258+
MeshRenderer:
1259+
m_ObjectHideFlags: 1
1260+
m_PrefabParentObject: {fileID: 0}
1261+
m_PrefabInternal: {fileID: 100100000}
1262+
m_GameObject: {fileID: 1643353808705120}
1263+
m_Enabled: 1
1264+
m_CastShadows: 1
1265+
m_ReceiveShadows: 1
1266+
m_DynamicOccludee: 1
1267+
m_MotionVectors: 1
1268+
m_LightProbeUsage: 1
1269+
m_ReflectionProbeUsage: 1
1270+
m_Materials:
1271+
- {fileID: 2100000, guid: c7fd02a3be8560848b9750d37e494732, type: 2}
1272+
m_StaticBatchInfo:
1273+
firstSubMesh: 0
1274+
subMeshCount: 0
1275+
m_StaticBatchRoot: {fileID: 0}
1276+
m_ProbeAnchor: {fileID: 0}
1277+
m_LightProbeVolumeOverride: {fileID: 0}
1278+
m_ScaleInLightmap: 1
1279+
m_PreserveUVs: 1
1280+
m_IgnoreNormalsForChartDetection: 0
1281+
m_ImportantGI: 0
1282+
m_StitchLightmapSeams: 0
1283+
m_SelectedEditorRenderState: 3
1284+
m_MinimumChartSize: 4
1285+
m_AutoUVMaxDistance: 0.5
1286+
m_AutoUVMaxAngle: 89
1287+
m_LightmapParameters: {fileID: 0}
1288+
m_SortingLayerID: 0
1289+
m_SortingLayer: 0
1290+
m_SortingOrder: 0
1291+
--- !u!33 &33727839429478732
1292+
MeshFilter:
1293+
m_ObjectHideFlags: 1
1294+
m_PrefabParentObject: {fileID: 0}
1295+
m_PrefabInternal: {fileID: 100100000}
1296+
m_GameObject: {fileID: 1643353808705120}
1297+
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
1298+
--- !u!33 &33944642234920852
1299+
MeshFilter:
1300+
m_ObjectHideFlags: 1
1301+
m_PrefabParentObject: {fileID: 0}
1302+
m_PrefabInternal: {fileID: 100100000}
1303+
m_GameObject: {fileID: 1343502948497016}
1304+
m_Mesh: {fileID: 0}
1305+
--- !u!54 &54299784005585486
1306+
Rigidbody:
1307+
m_ObjectHideFlags: 1
1308+
m_PrefabParentObject: {fileID: 0}
1309+
m_PrefabInternal: {fileID: 100100000}
1310+
m_GameObject: {fileID: 1343502948497016}
1311+
serializedVersion: 2
1312+
m_Mass: 1
1313+
m_Drag: 0
1314+
m_AngularDrag: 0.05
1315+
m_UseGravity: 1
1316+
m_IsKinematic: 0
1317+
m_Interpolate: 0
1318+
m_Constraints: 80
1319+
m_CollisionDetection: 0
1320+
--- !u!64 &64143605779186180
1321+
MeshCollider:
1322+
m_ObjectHideFlags: 1
1323+
m_PrefabParentObject: {fileID: 0}
1324+
m_PrefabInternal: {fileID: 100100000}
1325+
m_GameObject: {fileID: 1643353808705120}
1326+
m_Material: {fileID: 0}
1327+
m_IsTrigger: 0
1328+
m_Enabled: 1
1329+
serializedVersion: 3
1330+
m_Convex: 0
1331+
m_CookingOptions: 14
1332+
m_SkinWidth: 0.01
1333+
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
12231334
--- !u!95 &95563371354119556
12241335
Animator:
12251336
serializedVersion: 3
@@ -1260,7 +1371,7 @@ CapsuleCollider:
12601371
m_Material: {fileID: 0}
12611372
m_IsTrigger: 0
12621373
m_Enabled: 1
1263-
m_Radius: 0.32
1374+
m_Radius: 0.29
12641375
m_Height: 1.97
12651376
m_Direction: 1
12661377
m_Center: {x: 0, y: 0.96, z: 0}

Assets/Prefab/08-PerceptualSystem/samuzai_animation_ok.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,7 @@ CapsuleCollider:
26722672
m_Material: {fileID: 0}
26732673
m_IsTrigger: 0
26742674
m_Enabled: 1
2675-
m_Radius: 0.32
2675+
m_Radius: 0.23
26762676
m_Height: 1.97
26772677
m_Direction: 1
26782678
m_Center: {x: 0, y: 0.96, z: 0}

Assets/Scripts/08-PerceptualSystem/Component/BaseSensor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace LinhowePerceptualSystem
1212
public class BaseSensor : MonoBehaviour
1313
{
1414
public bool ToBeRemoved = false;
15+
protected Animator animator;
16+
protected Rigidbody _rigidbody;
1517
protected virtual void Awake()
1618
{
1719
InitSensor();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace LinhowePerceptualSystem
7+
{
8+
/// <summary>
9+
/// 存在持续时间的触发器
10+
/// </summary>
11+
public class LimitedTimeTraigger:BaseTraigger
12+
{
13+
/// <summary>
14+
/// 持续时间
15+
/// </summary>
16+
public int duration;
17+
public override void UpdateInfo()
18+
{
19+
if (--duration <= 0)
20+
ToBeRemoved = true;
21+
}
22+
}
23+
}

Assets/Scripts/08-PerceptualSystem/Component/LimitedTimeTraigger.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/08-PerceptualSystem/Component/SightSensor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ public class SightSensor:BaseSensor
1818

1919
//所能看到的最远距离
2020
public float viewDistance = 100f;
21-
private Animator animator;
21+
2222
private SectorMeshCreator creator = new SectorMeshCreator();
2323
private MeshFilter meshFilter;
2424
private Mesh mesh;
25-
private Rigidbody _rigidbody;
2625
private float lastfieldView, lastviewDistance;
2726
private int updateAction = 0;
2827
protected override void Awake()
@@ -85,7 +84,7 @@ private void DrawMesh()
8584
lastfieldView = fieldView;
8685
lastviewDistance = viewDistance;
8786
mesh = creator.CreateMesh
88-
(viewDistance, fieldView * 2, 1000, 1000, 1000);
87+
(viewDistance, fieldView * 2, 30, 1000, 1000);
8988
}
9089

9190
int[] tris = mesh.triangles;

0 commit comments

Comments
 (0)