瀏覽代碼

移动逻辑优化

wulifu 1 年之前
父節點
當前提交
c2434d11ed

+ 1 - 1
ActionTowerDefense/Assets/Resources/PhysicsMaterial/PlayerJumpCollider.physicMaterial

@@ -10,5 +10,5 @@ PhysicMaterial:
   dynamicFriction: 0
   staticFriction: 0
   bounciness: 0
-  frictionCombine: 0
+  frictionCombine: 1
   bounceCombine: 0

+ 1 - 1
ActionTowerDefense/Assets/Resources/Spine/king_devil/king_deil_Controller.controller

@@ -882,7 +882,7 @@ AnimationClip:
     m_Level: 0
     m_CycleOffset: 0
     m_HasAdditiveReferencePose: 0
-    m_LoopTime: 0
+    m_LoopTime: 1
     m_LoopBlend: 0
     m_LoopBlendOrientation: 0
     m_LoopBlendPositionY: 0

+ 575 - 12
ActionTowerDefense/Assets/Scenes/SampleScene.unity

@@ -123,6 +123,103 @@ NavMeshSettings:
     debug:
       m_Flags: 0
   m_NavMeshData: {fileID: 0}
+--- !u!1 &43346112
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 43346113}
+  - component: {fileID: 43346116}
+  - component: {fileID: 43346115}
+  - component: {fileID: 43346114}
+  m_Layer: 0
+  m_Name: Cube (1)
+  m_TagString: Plane
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &43346113
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 43346112}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -15, y: 0, z: 0}
+  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 2
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &43346114
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 43346112}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &43346115
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 43346112}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  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
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &43346116
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 43346112}
+  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
 --- !u!1 &156014734
 GameObject:
   m_ObjectHideFlags: 0
@@ -270,7 +367,6 @@ MonoBehaviour:
   extraFallGravity: -10
   jumpSpeed: 10
   maxMoveSpeed: 5
-  moveAcc: 5
   state: 1
   invincibleTime: 0
   totalInvincibleTime: 2
@@ -280,8 +376,20 @@ MonoBehaviour:
   totalCacheJumpTime: 0.1
   hurtKeepTime: 0
   totalHurtKeepTime: 0.5
+  attackTime: 0
+  totalAttackTime: 0.5
+  summonTime: 0
+  totalSummonTime: 0.5
+  cacheAttackTime: 0
+  totalCacheAttackTime: 0.1
+  cacheSummonTime: 0
+  totalCacheSummonTime: 0.1
   isDie: 0
+  isClickBtnJump: 0
   isClickBtnSouth: 0
+  isClickBtnEast: 0
+  isClickBtnWest: 0
+  isClickBtnNorth: 0
 --- !u!1 &242326044
 GameObject:
   m_ObjectHideFlags: 0
@@ -325,7 +433,7 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 1, y: 0.003, z: 1}
+  m_Size: {x: 1.2, y: 0.003, z: 1}
   m_Center: {x: 0, y: 0, z: 0}
 --- !u!4 &242326047
 Transform:
@@ -353,6 +461,7 @@ GameObject:
   - component: {fileID: 519420032}
   - component: {fileID: 519420031}
   - component: {fileID: 519420029}
+  - component: {fileID: 519420033}
   m_Layer: 0
   m_Name: Main Camera
   m_TagString: MainCamera
@@ -426,6 +535,24 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &519420033
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 519420028}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 584ea0f557c97344f9b229261554243d, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  player: {fileID: 1192490554}
+  offsetX: 3
+  offsetY: 2
+  offsetZ: -10
+  lerpValue: 3.5
+  targetPos: {x: 0, y: 0, z: 0}
 --- !u!1 &573441708
 GameObject:
   m_ObjectHideFlags: 0
@@ -471,6 +598,43 @@ BoxCollider:
   serializedVersion: 2
   m_Size: {x: 1.6, y: 5, z: 1}
   m_Center: {x: 0, y: 2.5, z: 0}
+--- !u!1 &585662580
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 585662581}
+  m_Layer: 0
+  m_Name: TestGround
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &585662581
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 585662580}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 1500161235}
+  - {fileID: 1687724999}
+  - {fileID: 43346113}
+  - {fileID: 1360535227}
+  - {fileID: 2111188094}
+  - {fileID: 2045679345}
+  m_Father: {fileID: 0}
+  m_RootOrder: 5
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &600836742
 GameObject:
   m_ObjectHideFlags: 0
@@ -744,7 +908,7 @@ Transform:
   - {fileID: 242326047}
   - {fileID: 573441709}
   m_Father: {fileID: 0}
-  m_RootOrder: 5
+  m_RootOrder: 4
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!65 &1192490552
 BoxCollider:
@@ -793,11 +957,10 @@ MonoBehaviour:
   foot: {fileID: 242326045}
   bodyCollider: {fileID: 1192490552}
   jumpBodyCollider: {fileID: 573441710}
-  extraRiseGravity: -30
-  extraFallGravity: -70
-  jumpSpeed: 25
-  maxMoveSpeed: 30
-  moveAcc: 200
+  extraRiseGravity: -80
+  extraFallGravity: -40
+  jumpSpeed: 30
+  maxMoveSpeed: 25
   state: 1
   invincibleTime: 0
   totalInvincibleTime: 2
@@ -807,8 +970,117 @@ MonoBehaviour:
   totalCacheJumpTime: 0.1
   hurtKeepTime: 0
   totalHurtKeepTime: 0.5
+  attackTime: 0
+  totalAttackTime: 0.5
+  summonTime: 0
+  totalSummonTime: 0.5
+  cacheAttackTime: 0
+  totalCacheAttackTime: 0.1
+  cacheSummonTime: 0
+  totalCacheSummonTime: 0.1
   isDie: 0
+  isClickBtnJump: 0
   isClickBtnSouth: 0
+  isClickBtnEast: 0
+  isClickBtnWest: 0
+  isClickBtnNorth: 0
+--- !u!1 &1360535226
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1360535227}
+  - component: {fileID: 1360535230}
+  - component: {fileID: 1360535229}
+  - component: {fileID: 1360535228}
+  m_Layer: 0
+  m_Name: Cube (2)
+  m_TagString: Plane
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1360535227
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1360535226}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -35, y: 0, z: 0}
+  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 3
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &1360535228
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1360535226}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &1360535229
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1360535226}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  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
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &1360535230
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1360535226}
+  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
 --- !u!1 &1500161231
 GameObject:
   m_ObjectHideFlags: 0
@@ -898,14 +1170,208 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1500161231}
-  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: -2, z: 0}
-  m_LocalScale: {x: 100, y: 1, z: 1}
+  m_LocalScale: {x: 1000, y: 2, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
-  m_Father: {fileID: 0}
-  m_RootOrder: 4
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1687724998
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1687724999}
+  - component: {fileID: 1687725002}
+  - component: {fileID: 1687725001}
+  - component: {fileID: 1687725000}
+  m_Layer: 0
+  m_Name: Cube
+  m_TagString: Plane
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1687724999
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1687724998}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -5, y: 0, z: 0}
+  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &1687725000
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1687724998}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &1687725001
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1687724998}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  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
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &1687725002
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1687724998}
+  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &2045679344
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2045679345}
+  - component: {fileID: 2045679348}
+  - component: {fileID: 2045679347}
+  - component: {fileID: 2045679346}
+  m_Layer: 0
+  m_Name: Cube (4)
+  m_TagString: Plane
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &2045679345
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2045679344}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -84.6, y: 1, z: 0}
+  m_LocalScale: {x: 15, y: 4, z: 2}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 5
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &2045679346
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2045679344}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &2045679347
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2045679344}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  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
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &2045679348
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2045679344}
+  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
 --- !u!1 &2062706297
 GameObject:
   m_ObjectHideFlags: 0
@@ -1030,3 +1496,100 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &2111188093
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2111188094}
+  - component: {fileID: 2111188097}
+  - component: {fileID: 2111188096}
+  - component: {fileID: 2111188095}
+  m_Layer: 0
+  m_Name: Cube (3)
+  m_TagString: Plane
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &2111188094
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2111188093}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -55, y: 1, z: 0}
+  m_LocalScale: {x: 6, y: 4, z: 2}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 585662581}
+  m_RootOrder: 4
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &2111188095
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2111188093}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &2111188096
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2111188093}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  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
+  m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &2111188097
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2111188093}
+  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}

+ 27 - 0
ActionTowerDefense/Assets/Scripts/CameraController.cs

@@ -0,0 +1,27 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class CameraController : MonoBehaviour
+{
+    public PlayerController player;
+    public float offsetX = 5, offsetY = 2, offsetZ = -10;
+    public float lerpValue = 0.02f;
+
+    [HideInInspector]
+    public Vector3 targetPos;
+
+    private void FixedUpdate()
+    {
+        if (player.transform.localScale.x > 0)
+        {
+            targetPos = player.transform.position + new Vector3 (-offsetX, offsetY, offsetZ);
+        }
+        else
+        {
+            targetPos = player.transform.position + new Vector3(offsetX, offsetY, offsetZ);
+        }
+
+        transform.position = Vector3.Lerp(transform.position, targetPos, lerpValue * Time.deltaTime);
+    }
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/CameraController.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 584ea0f557c97344f9b229261554243d
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 182 - 26
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -16,7 +16,8 @@ public enum PlayerState
     Fall = 4,//空中下落
     Hurt = 5,
     Attack = 6,
-    Die = 7,
+    Summon = 7,
+    Die = 8,
 }
 public class PlayerController : MonoBehaviour
 {
@@ -34,7 +35,7 @@ public class PlayerController : MonoBehaviour
     public float jumpSpeed = 10;
     //public float airJumpSpeed = 10;
     public float maxMoveSpeed = 5;
-    public float moveAcc = 5f;
+    //public float moveAcc = 5f;
     //public float airMoveAcc = 3f;
 
     public PlayerState state = PlayerState.Idle;
@@ -50,17 +51,61 @@ public class PlayerController : MonoBehaviour
     [HideInInspector]
     public float hurtKeepTime;
     public float totalHurtKeepTime = 0.5f;
+    [HideInInspector]
+    public float attackTime;
+    public float totalAttackTime = 0.5f;
+    [HideInInspector]
+    public float summonTime;
+    public float totalSummonTime = 0.5f;
+    [HideInInspector]
+    public float cacheAttackTime; //无法攻击时按下攻击键不会攻击,手感不好,缓存几帧,在这几帧内落地会立即攻击;
+    public float totalCacheAttackTime = 0.1f;
+    [HideInInspector]
+    public float cacheSummonTime; //无法召唤时按下召唤键不会召唤,手感不好,缓存几帧,在这几帧内落地会立即召唤;
+    public float totalCacheSummonTime = 0.1f;
 
     public bool isDie = false;
 
+    public bool btnJumpPress
+    {
+        get
+        {
+            return Input.GetKeyDown(KeyCode.Space) || isClickBtnJump;
+        }
+    }
+    public bool isClickBtnJump;
     public bool btnSouthPress
     {
         get
         {
-            return Input.GetKeyDown(KeyCode.Space) || isClickBtnSouth;
+            return Input.GetKeyDown(KeyCode.K) || isClickBtnSouth;
         }
     }
     public bool isClickBtnSouth;
+    public bool btnEastPress
+    {
+        get
+        {
+            return Input.GetKeyDown(KeyCode.L) || isClickBtnEast;
+        }
+    }
+    public bool isClickBtnEast;
+    public bool btnWestPress
+    {
+        get
+        {
+            return Input.GetKeyDown(KeyCode.J) || isClickBtnWest;
+        }
+    }
+    public bool isClickBtnWest;
+    public bool btnNorthPress
+    {
+        get
+        {
+            return Input.GetKeyDown(KeyCode.I) || isClickBtnNorth;
+        }
+    }
+    public bool isClickBtnNorth;
 
     public Vector2 leftDir
     {
@@ -81,9 +126,25 @@ public class PlayerController : MonoBehaviour
     private void Update()
     {
         if (Input.GetKeyDown(KeyCode.Space))
+        {
+            isClickBtnJump = true;
+        }
+        if (Input.GetKeyDown(KeyCode.J))
+        {
+            isClickBtnWest = true;
+        }
+        if (Input.GetKeyDown(KeyCode.K))
         {
             isClickBtnSouth = true;
         }
+        if (Input.GetKeyDown(KeyCode.L))
+        {
+            isClickBtnEast = true;
+        }
+        if (Input.GetKeyDown(KeyCode.I))
+        {
+            isClickBtnNorth = true;
+        }
     }
 
     private void FixedUpdate()
@@ -134,7 +195,12 @@ public class PlayerController : MonoBehaviour
         switch (state)
         {
             case PlayerState.Idle:
-                if (btnSouthPress || cacheJumpTime > 0)
+                if (btnWestPress || cacheAttackTime > 0)
+                {
+                    ChangeState(PlayerState.Attack);
+                    break;
+                }
+                if (btnJumpPress || cacheJumpTime > 0)
                 {
                     Jump();
                     ChangeState(PlayerState.Rise);
@@ -162,7 +228,12 @@ public class PlayerController : MonoBehaviour
                 //rb.velocity = Vector3.zero;
                 break;
             case PlayerState.Run:
-                if (btnSouthPress || cacheJumpTime > 0)
+                if (btnWestPress || cacheAttackTime > 0)
+                {
+                    ChangeState(PlayerState.Attack);
+                    break;
+                }
+                if (btnJumpPress || cacheJumpTime > 0)
                 {
                     Jump();
                     break;
@@ -188,12 +259,12 @@ public class PlayerController : MonoBehaviour
                 canJumpTime = leaveGroundCanJumpTime;
                 if (leftDir.x > 0.3f)
                 {
-                    rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
-                    //rb.velocity = Vector3.right * maxMoveSpeed;
-                    if (rb.velocity.x > maxMoveSpeed)
-                    {
-                        rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
-                    }
+                    //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
+                    rb.velocity = Vector3.right * maxMoveSpeed;
+                    //if (rb.velocity.x > maxMoveSpeed)
+                    //{
+                    //    rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
+                    //}
                     if (transform.localScale.x > 0)
                     {
                         Turn();
@@ -201,12 +272,12 @@ public class PlayerController : MonoBehaviour
                 }
                 else if (leftDir.x < -0.3f)
                 {
-                    rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
-                    //rb.velocity = Vector3.left * maxMoveSpeed;
-                    if (rb.velocity.x < -maxMoveSpeed)
-                    {
-                        rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
-                    }
+                    //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
+                    rb.velocity = Vector3.left * maxMoveSpeed;
+                    //if (rb.velocity.x < -maxMoveSpeed)
+                    //{
+                    //    rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
+                    //}
                     if (transform.localScale.x < 0)
                     {
                         Turn();
@@ -219,7 +290,7 @@ public class PlayerController : MonoBehaviour
                     ChangeState(PlayerState.Fall);
                     break;
                 }
-                //if (btnSouthPress || cacheJumpTime > 0)
+                //if (btnJumpPress || cacheJumpTime > 0)
                 //{
                 //    if (!airJumped && rb.velocity.y < airJumpSpeed)
                 //    {
@@ -228,12 +299,16 @@ public class PlayerController : MonoBehaviour
                 //        break;
                 //    }
                 //}
-                if (btnSouthPress)
+                if (btnJumpPress)
                 {
                     cacheJumpTime = totalCacheJumpTime;
                 }
+                if (btnWestPress)
+                {
+                    cacheAttackTime = totalCacheAttackTime;
+                }
                 rb.velocity += Vector3.up * extraRiseGravity * Time.deltaTime;
-                //AirMove();
+                AirMove();
                 break;
             case PlayerState.Fall:
                 if (foot.TrigGround)
@@ -253,7 +328,7 @@ public class PlayerController : MonoBehaviour
                 //    StepEnemy();
                 //    break;
                 //}
-                //if (btnSouthPress || cacheJumpTime > 0)
+                //if (btnJumpPress || cacheJumpTime > 0)
                 //{
                 //    if (!airJumped)
                 //    {
@@ -267,12 +342,16 @@ public class PlayerController : MonoBehaviour
                 //        break;
                 //    }
                 //}
-                if (btnSouthPress)
+                if (btnJumpPress)
                 {
                     cacheJumpTime = totalCacheJumpTime;
                 }
+                if (btnWestPress)
+                {
+                    cacheAttackTime = totalCacheAttackTime;
+                }
                 rb.velocity += Vector3.up * extraFallGravity * Time.deltaTime;
-                //AirMove();
+                AirMove();
                 break;
             case PlayerState.Hurt:
                 if (hurtKeepTime <= 0)
@@ -280,10 +359,14 @@ public class PlayerController : MonoBehaviour
                     ChangeState(PlayerState.Idle);
                     break;
                 }
-                if (btnSouthPress)
+                if (btnJumpPress)
                 {
                     cacheJumpTime = totalCacheJumpTime;
                 }
+                if (btnWestPress)
+                {
+                    cacheAttackTime = totalCacheAttackTime;
+                }
                 if (!foot.TrigGround)
                 {
                     rb.velocity += Vector3.up * extraFallGravity * Time.deltaTime;
@@ -291,12 +374,43 @@ public class PlayerController : MonoBehaviour
                 rb.velocity = rb.velocity / 5 * 4;
                 break;
             case PlayerState.Attack:
-                
+                if (attackTime <= 0)
+                {
+                    ChangeState(PlayerState.Idle);
+                    break;
+                }
+                if (btnJumpPress)
+                {
+                    cacheJumpTime = totalCacheJumpTime;
+                }
+                if (btnWestPress)
+                {
+                    cacheAttackTime = totalCacheAttackTime;
+                }
+                break;
+            case PlayerState.Summon:
+                if (summonTime <= 0)
+                {
+                    ChangeState(PlayerState.Idle);
+                    break;
+                }
+                if (btnJumpPress)
+                {
+                    cacheJumpTime = totalCacheJumpTime;
+                }
+                if (btnWestPress)
+                {
+                    cacheAttackTime = totalCacheAttackTime;
+                }
                 break;
             default:
                 break;
         }
+        isClickBtnJump = false;
         isClickBtnSouth = false;
+        isClickBtnEast = false;
+        isClickBtnNorth = false;
+        isClickBtnWest = false;
     }
 
     public void ChangeState(PlayerState newState)
@@ -336,7 +450,7 @@ public class PlayerController : MonoBehaviour
                 {
                     ani.Play("idle", 0, 0);
                 }
-                //rb.velocity = Vector3.zero;
+                rb.velocity = Vector3.zero;
                 //animalAni.SetInteger("state", (int)PlayerState.Idle);
                 break;
             case PlayerState.Run:
@@ -368,6 +482,13 @@ public class PlayerController : MonoBehaviour
                 bodyCollider.enabled = true;
                 jumpBodyCollider.enabled = false;
                 ani.Play("attack1", 0, 0);
+                attackTime = totalAttackTime;
+                break;
+            case PlayerState.Summon:
+                bodyCollider.enabled = true;
+                jumpBodyCollider.enabled = false;
+                ani.Play("summon", 0, 0);
+                summonTime = totalSummonTime;
                 break;
             case PlayerState.Die:
                 bodyCollider.enabled = false;
@@ -379,4 +500,39 @@ public class PlayerController : MonoBehaviour
                 break;
         }
     }
+
+    public void AirMove()
+    {
+        if (leftDir.x > 0.3f)
+        {
+            //rb.velocity += Vector3.right * airMoveAcc * deltaTime;
+            ////rb.velocity = Vector3.right * maxMoveSpeed;
+            //if (rb.velocity.x > maxMoveSpeed)
+            //{
+                rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
+            //}
+            if (transform.localScale.x > 0)
+            {
+                Turn();
+            }
+        }
+        else if (leftDir.x < -0.3f)
+        {
+            //rb.velocity -= Vector3.right * airMoveAcc * deltaTime;
+            ////rb.velocity = Vector3.left * maxMoveSpeed;
+            //if (rb.velocity.x < -maxMoveSpeed)
+            //{
+                rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
+            //}
+            if (transform.localScale.x < 0)
+            {
+                Turn();
+            }
+        }
+        else
+        {
+            rb.velocity = new Vector3(0, rb.velocity.y, rb.velocity.z);
+        }
+    }
+
 }