From 73c5078af07f0fb6193a2b1c5855fb816cd337d4 Mon Sep 17 00:00:00 2001 From: Julien De Conti Date: Sat, 16 Sep 2017 11:21:21 +0200 Subject: [PATCH] Revert "[Unity] Refactor scripts and components in Player prefab" This reverts commit af891846ae980d830a5121745cd56f7432ed9ff3. --- Assets/Prefabs/Bullet.prefab | 2 +- Assets/Prefabs/{Player.prefab => Tank.prefab} | 279 ++++----- .../{Player.prefab.meta => Tank.prefab.meta} | 0 Assets/Scenes/GameScene.unity | 554 ++++++++++++++++-- Assets/Scripts/Bullet/Bullet.cs | 4 +- Assets/Scripts/Bullet/BulletLauncher.cs | 25 + .../{Tank => Bullet}/BulletLauncher.cs.meta | 0 Assets/Scripts/GameManager.cs | 12 +- Assets/Scripts/Tank/BulletLauncher.cs | 26 - Assets/Scripts/Tank/Gun.cs | 35 +- Assets/Scripts/Tank/Tank.cs | 33 +- .../TankController.cs} | 42 +- .../TankController.cs.meta} | 4 +- Assets/Scripts/Tank/Turret.cs | 24 +- 14 files changed, 737 insertions(+), 303 deletions(-) rename Assets/Prefabs/{Player.prefab => Tank.prefab} (64%) rename Assets/Prefabs/{Player.prefab.meta => Tank.prefab.meta} (100%) create mode 100644 Assets/Scripts/Bullet/BulletLauncher.cs rename Assets/Scripts/{Tank => Bullet}/BulletLauncher.cs.meta (100%) delete mode 100644 Assets/Scripts/Tank/BulletLauncher.cs rename Assets/Scripts/{PlayerController.cs => Tank/TankController.cs} (50%) rename Assets/Scripts/{PlayerController.cs.meta => Tank/TankController.cs.meta} (76%) diff --git a/Assets/Prefabs/Bullet.prefab b/Assets/Prefabs/Bullet.prefab index 8590857..ff2bf9c 100644 --- a/Assets/Prefabs/Bullet.prefab +++ b/Assets/Prefabs/Bullet.prefab @@ -109,7 +109,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f58414871f90d014fad4dac38afca2d6, type: 3} m_Name: m_EditorClassIdentifier: - m_particleEffect: {fileID: 1814433479905170, guid: da0ea28482e581442926a920a7c08491, + particleEffect: {fileID: 1814433479905170, guid: da0ea28482e581442926a920a7c08491, type: 2} --- !u!135 &135536798888832452 SphereCollider: diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Tank.prefab similarity index 64% rename from Assets/Prefabs/Player.prefab rename to Assets/Prefabs/Tank.prefab index 880c346..bc3697c 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Tank.prefab @@ -9,260 +9,230 @@ Prefab: m_Modifications: [] m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 1386483902686902} + m_RootGameObject: {fileID: 1752694189557910} m_IsPrefabParent: 1 ---- !u!1 &1386483902686902 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4112706101230068} - - component: {fileID: 114417469554669342} - m_Layer: 0 - m_Name: Player - m_TagString: Player - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!1 &1454915651747040 +--- !u!1 &1013344958065602 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4055562981043630} - - component: {fileID: 33125332155488702} - - component: {fileID: 23122833673609374} - - component: {fileID: 64264277483290730} + - component: {fileID: 4353522743120690} + - component: {fileID: 33728068488324336} + - component: {fileID: 23121069006874854} + - component: {fileID: 64814460354329350} m_Layer: 0 - m_Name: Hull + m_Name: Cylinder m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1474609666595224 +--- !u!1 &1269824514600220 GameObject: - m_ObjectHideFlags: 1 + m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4078780675956272} - - component: {fileID: 114687604783305152} + - component: {fileID: 4573391977931920} + - component: {fileID: 114329715807555444} m_Layer: 0 - m_Name: Turret + m_Name: Head m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1574482108023260 +--- !u!1 &1414694087376174 GameObject: - m_ObjectHideFlags: 1 + m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4617103288859144} - - component: {fileID: 114828655202701612} + - component: {fileID: 4229871670549278} m_Layer: 0 - m_Name: Gun + m_Name: Body m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1611415959057476 +--- !u!1 &1752694189557910 GameObject: - m_ObjectHideFlags: 1 + m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4633231246655606} - - component: {fileID: 33192816611869134} - - component: {fileID: 23801980535470442} - - component: {fileID: 64609066064451704} + - component: {fileID: 4201041137715950} + - component: {fileID: 54441602361010244} + - component: {fileID: 114052598749598698} + - component: {fileID: 114146425186995170} m_Layer: 0 - m_Name: TurretRing - m_TagString: Untagged + m_Name: Tank + m_TagString: Player m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1613136940816434 +--- !u!1 &1769826107167420 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4731901314347142} - - component: {fileID: 114084393600287616} + - component: {fileID: 4271794203298198} + - component: {fileID: 33241883414851728} + - component: {fileID: 136069461298996716} + - component: {fileID: 23494528124475632} m_Layer: 0 - m_Name: BulletLauncher + m_Name: Cylinder m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1738819892746278 +--- !u!1 &1798815212942496 GameObject: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4304155062429100} - - component: {fileID: 33621844271290128} - - component: {fileID: 136284396006025140} - - component: {fileID: 23856858250497208} + - component: {fileID: 4855528594265846} + - component: {fileID: 114357068546324432} m_Layer: 0 - m_Name: Barrel + m_Name: Gun m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &1761015209267878 +--- !u!1 &1939667470558662 GameObject: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} serializedVersion: 5 m_Component: - - component: {fileID: 4821996767006762} - - component: {fileID: 54569503761421354} - - component: {fileID: 114030451632141330} + - component: {fileID: 4163721175445228} + - component: {fileID: 33495513871263130} + - component: {fileID: 23834740194721126} + - component: {fileID: 64808140900260828} m_Layer: 0 - m_Name: Tank + m_Name: Cylinder m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &4055562981043630 +--- !u!4 &4163721175445228 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1454915651747040} + m_GameObject: {fileID: 1939667470558662} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.3, z: 0} - m_LocalScale: {x: 2.5, y: 0.3, z: 2.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 0.24999999, z: 1} m_Children: [] - m_Father: {fileID: 4821996767006762} + m_Father: {fileID: 4573391977931920} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4078780675956272 +--- !u!4 &4201041137715950 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1474609666595224} + m_GameObject: {fileID: 1752694189557910} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4633231246655606} - - {fileID: 4617103288859144} - m_Father: {fileID: 4821996767006762} - m_RootOrder: 1 + - {fileID: 4229871670549278} + - {fileID: 4573391977931920} + m_Father: {fileID: 0} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4112706101230068 +--- !u!4 &4229871670549278 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1386483902686902} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_GameObject: {fileID: 1414694087376174} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4821996767006762} - m_Father: {fileID: 0} + - {fileID: 4353522743120690} + m_Father: {fileID: 4201041137715950} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4304155062429100 +--- !u!4 &4271794203298198 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1738819892746278} + m_GameObject: {fileID: 1769826107167420} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.3, y: 0.75, z: 0.3} m_Children: [] - m_Father: {fileID: 4617103288859144} + m_Father: {fileID: 4855528594265846} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!4 &4617103288859144 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1574482108023260} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0.85, z: 0.5} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 4304155062429100} - - {fileID: 4731901314347142} - m_Father: {fileID: 4078780675956272} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4633231246655606 +--- !u!4 &4353522743120690 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1611415959057476} + m_GameObject: {fileID: 1013344958065602} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.85, z: 0} - m_LocalScale: {x: 1, y: 0.24999999, z: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.5, y: 0.3, z: 2.5} m_Children: [] - m_Father: {fileID: 4078780675956272} + m_Father: {fileID: 4229871670549278} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4731901314347142 +--- !u!4 &4573391977931920 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1613136940816434} + m_GameObject: {fileID: 1269824514600220} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0, z: 0.7500001} - m_LocalScale: {x: 0.3, y: 0.30000007, z: 0.75000024} - m_Children: [] - m_Father: {fileID: 4617103288859144} + m_LocalPosition: {x: 0, y: 0.85, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4163721175445228} + - {fileID: 4855528594265846} + m_Father: {fileID: 4201041137715950} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &4821996767006762 +--- !u!4 &4855528594265846 Transform: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1761015209267878} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_GameObject: {fileID: 1798815212942496} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.5} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 4055562981043630} - - {fileID: 4078780675956272} - m_Father: {fileID: 4112706101230068} - m_RootOrder: 0 + - {fileID: 4271794203298198} + m_Father: {fileID: 4573391977931920} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &23122833673609374 +--- !u!23 &23121069006874854 MeshRenderer: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1454915651747040} + m_GameObject: {fileID: 1013344958065602} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -289,12 +259,12 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 ---- !u!23 &23801980535470442 +--- !u!23 &23494528124475632 MeshRenderer: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1611415959057476} + m_GameObject: {fileID: 1769826107167420} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -321,12 +291,12 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 ---- !u!23 &23856858250497208 +--- !u!23 &23834740194721126 MeshRenderer: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1738819892746278} + m_GameObject: {fileID: 1939667470558662} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -353,33 +323,33 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 ---- !u!33 &33125332155488702 +--- !u!33 &33241883414851728 MeshFilter: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1454915651747040} + m_GameObject: {fileID: 1769826107167420} m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &33192816611869134 +--- !u!33 &33495513871263130 MeshFilter: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1611415959057476} + m_GameObject: {fileID: 1939667470558662} m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &33621844271290128 +--- !u!33 &33728068488324336 MeshFilter: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1738819892746278} + m_GameObject: {fileID: 1013344958065602} m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!54 &54569503761421354 +--- !u!54 &54441602361010244 Rigidbody: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1761015209267878} + m_GameObject: {fileID: 1752694189557910} serializedVersion: 2 m_Mass: 1 m_Drag: 0.1 @@ -389,13 +359,13 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 112 m_CollisionDetection: 0 ---- !u!64 &64264277483290730 +--- !u!64 &64808140900260828 MeshCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1454915651747040} - m_Material: {fileID: 13400000, guid: 1274ba63cf21f44c8a5bb3604f890c28, type: 2} + m_GameObject: {fileID: 1939667470558662} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -403,13 +373,13 @@ MeshCollider: m_InflateMesh: 0 m_SkinWidth: 0.01 m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!64 &64609066064451704 +--- !u!64 &64814460354329350 MeshCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1611415959057476} - m_Material: {fileID: 13400000, guid: 1274ba63cf21f44c8a5bb3604f890c28, type: 2} + m_GameObject: {fileID: 1013344958065602} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -417,77 +387,58 @@ MeshCollider: m_InflateMesh: 0 m_SkinWidth: 0.01 m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!114 &114030451632141330 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1761015209267878} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 60e5d803e7c524d588d3cf76486b10d2, type: 3} - m_Name: - m_EditorClassIdentifier: - m_hull: {fileID: 1454915651747040} - m_turret: {fileID: 1474609666595224} - m_gun: {fileID: 1574482108023260} - m_bulletLauncher: {fileID: 1613136940816434} - m_movePower: 10 - m_jumpPower: 2 ---- !u!114 &114084393600287616 +--- !u!114 &114052598749598698 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1613136940816434} + m_GameObject: {fileID: 1752694189557910} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e09010c4e88f7e142900b311254cfbb9, type: 3} + m_Script: {fileID: 11500000, guid: fa97d1196d0a948a9b09a48042b747ca, type: 3} m_Name: m_EditorClassIdentifier: - m_ammunition: {fileID: 54164521481822558, guid: c11f6500e77560c46a4681ab4a36e481, - type: 2} - m_ejectSpeed: 100 - m_fireRate: 0.5 ---- !u!114 &114417469554669342 +--- !u!114 &114146425186995170 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1386483902686902} + m_GameObject: {fileID: 1752694189557910} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 880740f8e41344a78a69e65b699372ad, type: 3} + m_Script: {fileID: 11500000, guid: 60e5d803e7c524d588d3cf76486b10d2, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &114687604783305152 + m_MovePower: 15 + m_JumpPower: 2 +--- !u!114 &114329715807555444 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1474609666595224} + m_GameObject: {fileID: 1269824514600220} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: dee75bba77dae4de7bdb2d4668d43c73, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &114828655202701612 +--- !u!114 &114357068546324432 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1574482108023260} + m_GameObject: {fileID: 1798815212942496} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0a8a7b082838e4465b870c46307f9755, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!136 &136284396006025140 +--- !u!136 &136069461298996716 CapsuleCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1738819892746278} + m_GameObject: {fileID: 1769826107167420} m_Material: {fileID: 13400000, guid: 1274ba63cf21f44c8a5bb3604f890c28, type: 2} m_IsTrigger: 0 m_Enabled: 1 diff --git a/Assets/Prefabs/Player.prefab.meta b/Assets/Prefabs/Tank.prefab.meta similarity index 100% rename from Assets/Prefabs/Player.prefab.meta rename to Assets/Prefabs/Tank.prefab.meta diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 3280099..b1d322f 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1278374322} - m_IndirectSpecularColor: {r: 0.4508229, g: 0.50073963, b: 0.57469445, a: 1} + m_IndirectSpecularColor: {r: 0.45082325, g: 0.5007398, b: 0.57469505, a: 1} --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 @@ -108,6 +108,35 @@ NavMeshSettings: tileSize: 256 accuratePlacement: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &79074843 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 79074844} + m_Layer: 0 + m_Name: Body + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &79074844 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 79074843} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 581284333} + m_Father: {fileID: 1818485904} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &79765585 GameObject: m_ObjectHideFlags: 0 @@ -607,6 +636,50 @@ Prefab: Transform: m_PrefabParentObject: {fileID: 400000, guid: 3681543e5b0f59742b73073cb379cdc6, type: 2} m_PrefabInternal: {fileID: 315166087} +--- !u!1 &357528134 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 357528135} + - component: {fileID: 357528136} + m_Layer: 0 + m_Name: BulletLauncher + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &357528135 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 357528134} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -0, z: 0.7500001} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1199733919} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &357528136 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 357528134} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e09010c4e88f7e142900b311254cfbb9, type: 3} + m_Name: + m_EditorClassIdentifier: + ammunition: {fileID: 54164521481822558, guid: c11f6500e77560c46a4681ab4a36e481, + type: 2} + ejectSpeed: 100 + fireRate: 0.5 --- !u!1 &433169707 GameObject: m_ObjectHideFlags: 0 @@ -668,6 +741,90 @@ Transform: m_Father: {fileID: 1220512697} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &581284332 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 581284333} + - component: {fileID: 581284337} + - component: {fileID: 581284335} + - component: {fileID: 581284334} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &581284333 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 581284332} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.5, y: 0.3, z: 2.5} + m_Children: [] + m_Father: {fileID: 79074844} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &581284334 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 581284332} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 1 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &581284335 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 581284332} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: fe39da0b6e5c447a5a88c48f158bf67e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &581284337 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 581284332} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} --- !u!1001 &600462393 Prefab: m_ObjectHideFlags: 0 @@ -862,48 +1019,6 @@ Transform: m_Father: {fileID: 1454461115} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1112934114 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4112706101230068, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 360ad8205ed019f4aaa1f33e2ab6c6e1, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1165215870 GameObject: m_ObjectHideFlags: 0 @@ -931,7 +1046,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3e02af307f7fc4d4c85633702616d91d, type: 3} m_Name: m_EditorClassIdentifier: - m_lockCursor: 1 --- !u!4 &1165215872 Transform: m_ObjectHideFlags: 0 @@ -945,6 +1059,48 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1199733918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1199733919} + - component: {fileID: 1199733920} + m_Layer: 0 + m_Name: Gun + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1199733919 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1199733918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1557611747} + - {fileID: 357528135} + m_Father: {fileID: 1421142227} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1199733920 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1199733918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a8a7b082838e4465b870c46307f9755, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &1220512697 Transform: m_ObjectHideFlags: 0 @@ -1028,6 +1184,77 @@ Light: m_UseColorTemperature: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 +--- !u!1 &1405335934 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1405335935} + m_Layer: 0 + m_Name: Player + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1405335935 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1405335934} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1818485904} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1421142226 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1421142227} + - component: {fileID: 1421142228} + m_Layer: 0 + m_Name: Turret + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1421142227 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1421142226} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.85, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1498922487} + - {fileID: 1199733919} + m_Father: {fileID: 1818485904} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1421142228 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1421142226} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dee75bba77dae4de7bdb2d4668d43c73, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1454461114 GameObject: m_ObjectHideFlags: 0 @@ -1159,6 +1386,173 @@ Prefab: Transform: m_PrefabParentObject: {fileID: 400000, guid: 93e86b57e56570d46814839867bf9a52, type: 2} m_PrefabInternal: {fileID: 1459147730} +--- !u!1 &1498922486 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1498922487} + - component: {fileID: 1498922490} + - component: {fileID: 1498922488} + - component: {fileID: 1498922489} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1498922487 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1498922486} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 0.24999999, z: 1} + m_Children: [] + m_Father: {fileID: 1421142227} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1498922488 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1498922486} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: fe39da0b6e5c447a5a88c48f158bf67e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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 &1498922489 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1498922486} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Convex: 1 + m_InflateMesh: 0 + m_SkinWidth: 0.01 + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1498922490 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1498922486} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1557611746 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1557611747} + - component: {fileID: 1557611750} + - component: {fileID: 1557611749} + - component: {fileID: 1557611748} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1557611747 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1557611746} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.3, y: 0.75, z: 0.3} + m_Children: [] + m_Father: {fileID: 1199733919} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!23 &1557611748 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1557611746} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: fe39da0b6e5c447a5a88c48f158bf67e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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!136 &1557611749 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1557611746} + m_Material: {fileID: 13400000, guid: 1274ba63cf21f44c8a5bb3604f890c28, type: 2} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.5 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1557611750 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1557611746} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} --- !u!1001 &1721663489 Prefab: m_ObjectHideFlags: 0 @@ -1261,6 +1655,78 @@ Prefab: Transform: m_PrefabParentObject: {fileID: 400000, guid: 93e86b57e56570d46814839867bf9a52, type: 2} m_PrefabInternal: {fileID: 1721663489} +--- !u!1 &1818485903 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1818485904} + - component: {fileID: 1818485907} + - component: {fileID: 1818485906} + - component: {fileID: 1818485905} + m_Layer: 0 + m_Name: Tank + m_TagString: Player + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1818485904 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1818485903} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 79074844} + - {fileID: 1421142227} + m_Father: {fileID: 1405335935} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1818485905 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1818485903} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 60e5d803e7c524d588d3cf76486b10d2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_MovePower: 15 + m_JumpPower: 2 +--- !u!114 &1818485906 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1818485903} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fa97d1196d0a948a9b09a48042b747ca, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!54 &1818485907 +Rigidbody: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1818485903} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0.1 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 112 + m_CollisionDetection: 0 --- !u!1 &1912016978 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Bullet/Bullet.cs b/Assets/Scripts/Bullet/Bullet.cs index 9c8c928..bf1ed9b 100644 --- a/Assets/Scripts/Bullet/Bullet.cs +++ b/Assets/Scripts/Bullet/Bullet.cs @@ -4,7 +4,7 @@ namespace Diep3D.Bullet { public class Bullet : MonoBehaviour { - [SerializeField] private GameObject m_particleEffect; + [SerializeField] private GameObject particleEffect; void OnCollisionEnter(Collision collision) { @@ -25,7 +25,7 @@ void OnCollisionEnter(Collision collision) void SpawnParticleEffect(Vector3 position, Quaternion rotation) { - Instantiate(m_particleEffect, position, rotation); + Instantiate(particleEffect, position, rotation); } } } \ No newline at end of file diff --git a/Assets/Scripts/Bullet/BulletLauncher.cs b/Assets/Scripts/Bullet/BulletLauncher.cs new file mode 100644 index 0000000..81cb2f8 --- /dev/null +++ b/Assets/Scripts/Bullet/BulletLauncher.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using UnityStandardAssets.CrossPlatformInput; + +namespace Diep3D.Bullet +{ + public class BulletLauncher : MonoBehaviour + { + [SerializeField] private Rigidbody ammunition; + [SerializeField] private float ejectSpeed; + [SerializeField] private float fireRate; + + private float nextFire = 0.0f; + + void Update() + { + if (CrossPlatformInputManager.GetButton("Fire1") && Time.time > nextFire) + { + nextFire = Time.time + fireRate; + + Rigidbody bullet = Instantiate(ammunition, transform.position, transform.rotation); + bullet.AddForce(transform.TransformDirection(Vector3.forward * ejectSpeed)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Tank/BulletLauncher.cs.meta b/Assets/Scripts/Bullet/BulletLauncher.cs.meta similarity index 100% rename from Assets/Scripts/Tank/BulletLauncher.cs.meta rename to Assets/Scripts/Bullet/BulletLauncher.cs.meta diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 61c7885..c7e0335 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -4,12 +4,12 @@ namespace Diep3D { public class GameManager : MonoBehaviour { - [SerializeField] private bool m_lockCursor = true; + [SerializeField] private bool lockCursor = true; void Start() { - Cursor.visible = !m_lockCursor; - Cursor.lockState = m_lockCursor ? CursorLockMode.Locked : CursorLockMode.None; + Cursor.visible = !lockCursor; + Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None; } #if UNITY_EDITOR @@ -18,10 +18,10 @@ void Update() // pressing esc toggles between hide/show if (Input.GetKeyDown(KeyCode.C)) { - m_lockCursor = !m_lockCursor; + lockCursor = !lockCursor; } - Cursor.visible = !m_lockCursor; - Cursor.lockState = m_lockCursor ? CursorLockMode.Locked : CursorLockMode.None; + Cursor.visible = !lockCursor; + Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None; } #endif } diff --git a/Assets/Scripts/Tank/BulletLauncher.cs b/Assets/Scripts/Tank/BulletLauncher.cs deleted file mode 100644 index 6feec0e..0000000 --- a/Assets/Scripts/Tank/BulletLauncher.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; -using UnityStandardAssets.CrossPlatformInput; - -namespace Diep3D.Tank -{ - public class BulletLauncher : MonoBehaviour - { - public Rigidbody m_ammunition; - - [SerializeField] private float m_ejectSpeed = 100f; - [SerializeField] private float m_fireRate = 0.5f; - - private float nextFire = 0.0f; - - public void Fire() - { - if (Time.time > nextFire) - { - nextFire = Time.time + m_fireRate; - - Rigidbody bullet = Instantiate(m_ammunition, transform.position, transform.rotation); - bullet.AddForce(transform.TransformDirection(Vector3.forward * m_ejectSpeed)); - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Tank/Gun.cs b/Assets/Scripts/Tank/Gun.cs index 2607a64..355bb6c 100644 --- a/Assets/Scripts/Tank/Gun.cs +++ b/Assets/Scripts/Tank/Gun.cs @@ -4,19 +4,40 @@ namespace Diep3D.Tank { public class Gun : MonoBehaviour { - public void Move(Vector3 directionEulerAngle) + private Transform m_followingCamera; + + private void Awake() { - if (directionEulerAngle.x <= 6.5f || directionEulerAngle.x >= 307.5f) // -6.5° to 52.5° + // Get the transform of the main camera + if (Camera.main != null) { - transform.eulerAngles = new Vector3(directionEulerAngle.x, transform.eulerAngles.y, transform.eulerAngles.z); + m_followingCamera = Camera.main.transform; } - else if (directionEulerAngle.x < 270f) // -90° to -6.5° + else { - transform.eulerAngles = new Vector3(6.5f, transform.eulerAngles.y, transform.eulerAngles.z); + Debug.LogWarning("Warning: no main camera found. Tank needs a Camera tagged \"MainCamera\", for camera-relative controls."); } - else if (directionEulerAngle.x < 307.5f) // 53° to 90° + } + + private void Update() + { + } + + + private void FixedUpdate() + { + // The gun follow the ascent and descent of the aim (betwen -15° and 30° up) + if (m_followingCamera.eulerAngles.x <= 5f || m_followingCamera.eulerAngles.x >= 285f) // -15 to 75° + { + transform.eulerAngles = new Vector3(m_followingCamera.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); + } + else if (m_followingCamera.eulerAngles.x < 270f) // -90° to -15 { - transform.eulerAngles = new Vector3(307.5f, transform.eulerAngles.y, transform.eulerAngles.z); + transform.eulerAngles = new Vector3(5f, transform.eulerAngles.y, transform.eulerAngles.z); + } + else if (m_followingCamera.eulerAngles.x < 285f) // 75° to 90° + { + transform.eulerAngles = new Vector3(285f, transform.eulerAngles.y, transform.eulerAngles.z); } } } diff --git a/Assets/Scripts/Tank/Tank.cs b/Assets/Scripts/Tank/Tank.cs index a64a95c..d1c0003 100644 --- a/Assets/Scripts/Tank/Tank.cs +++ b/Assets/Scripts/Tank/Tank.cs @@ -4,13 +4,8 @@ namespace Diep3D.Tank { public class Tank : MonoBehaviour { - public GameObject m_hull; - public GameObject m_turret; - public GameObject m_gun; - public GameObject m_bulletLauncher; - - [SerializeField] private float m_movePower = 15f; - [SerializeField] private float m_jumpPower = 2f; + [SerializeField] private float m_MovePower; + [SerializeField] private float m_JumpPower; private Rigidbody m_Rigidbody; private const float m_GroundCheckDistance = 0.51f; // The length of the ray to check if the tank is grounded. @@ -33,6 +28,18 @@ private void OnDisable() m_Rigidbody.isKinematic = true; } + public void Move(Vector3 moveDirection, bool jump) + { + // Add force in the move direction. + m_Rigidbody.AddForce(moveDirection * m_MovePower); + + // If not going down (approximation to -0.01...) and close to the ground and jump is pressed... + if (m_Rigidbody.velocity.y >= -0.01 && CheckGroundStatus() && jump) + { + m_Rigidbody.AddForce(Vector3.up * m_JumpPower, ForceMode.Impulse); + } + } + bool CheckGroundStatus() { RaycastHit hitInfo; @@ -50,17 +57,5 @@ bool CheckGroundStatus() return false; } } - - public void Move(Vector3 moveDirection, bool jump) - { - // Add force in the move direction. - m_Rigidbody.AddForce(moveDirection * m_movePower); - - // If not going down (approximation to -0.01...) and close to the ground and jump is pressed... - if (m_Rigidbody.velocity.y >= -0.01 && CheckGroundStatus() && jump) - { - m_Rigidbody.AddForce(Vector3.up * m_jumpPower, ForceMode.Impulse); - } - } } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/Tank/TankController.cs similarity index 50% rename from Assets/Scripts/PlayerController.cs rename to Assets/Scripts/Tank/TankController.cs index 3471eaa..693752c 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/Tank/TankController.cs @@ -1,25 +1,23 @@ using UnityEngine; using UnityStandardAssets.CrossPlatformInput; -namespace Diep3D +namespace Diep3D.Tank { - public class PlayerController : MonoBehaviour + public class TankController : MonoBehaviour { - private Tank.Tank m_tank; - private Camera m_followingCamera; - private Vector3 m_engineDirection; - private Vector3 m_gunDirection; + private Tank m_tank; + private Vector3 m_moveVector; + private Transform m_followingCamera; private bool m_jump; - private bool m_fire; private void Awake() { - m_tank = GetComponentInChildren(); + m_tank = GetComponent(); // Get the transform of the main camera if (Camera.main != null) { - m_followingCamera = Camera.main; + m_followingCamera = Camera.main.transform; } else { @@ -30,7 +28,7 @@ private void Awake() private void OnEnable() { // Reset any pre-existent movement - m_engineDirection = Vector3.zero; + m_moveVector = Vector3.zero; } private void Update() @@ -42,39 +40,23 @@ private void Update() // Check if jump is pressed m_jump = CrossPlatformInputManager.GetButton("Jump"); - // Check if fire is pressed - m_fire = CrossPlatformInputManager.GetButton("Fire1"); - if (m_followingCamera != null) { // Calculate camera relative direction to move: - Vector3 camForward = Vector3.Scale(m_followingCamera.transform.forward, new Vector3(1, 0, 1)).normalized; - m_engineDirection = (v * camForward + h * m_followingCamera.transform.right).normalized; + Vector3 camForward = Vector3.Scale(m_followingCamera.forward, new Vector3(1, 0, 1)).normalized; + m_moveVector = (v * camForward + h * m_followingCamera.right).normalized; } else { // We use world-relative directions in the case of no main camera - m_engineDirection = (v * Vector3.forward + h * Vector3.right).normalized; + m_moveVector = (v * Vector3.forward + h * Vector3.right).normalized; } } private void FixedUpdate() { - // Move the engine - m_tank.Move(m_engineDirection, m_jump); - - // Turn the turret - m_tank.m_turret.GetComponent().Move(m_followingCamera.transform.forward); - - // Turn the barrel - m_tank.m_gun.GetComponent().Move(m_followingCamera.transform.eulerAngles); - - // Shoot - if (m_fire) - { - m_tank.m_bulletLauncher.GetComponent().Fire(); - } + m_tank.Move(m_moveVector, m_jump); } } } diff --git a/Assets/Scripts/PlayerController.cs.meta b/Assets/Scripts/Tank/TankController.cs.meta similarity index 76% rename from Assets/Scripts/PlayerController.cs.meta rename to Assets/Scripts/Tank/TankController.cs.meta index f21159a..30ffedb 100644 --- a/Assets/Scripts/PlayerController.cs.meta +++ b/Assets/Scripts/Tank/TankController.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 880740f8e41344a78a69e65b699372ad -timeCreated: 1505336396 +guid: fa97d1196d0a948a9b09a48042b747ca +timeCreated: 1505061589 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/Tank/Turret.cs b/Assets/Scripts/Tank/Turret.cs index 0aa8587..1c3f514 100644 --- a/Assets/Scripts/Tank/Turret.cs +++ b/Assets/Scripts/Tank/Turret.cs @@ -4,9 +4,29 @@ namespace Diep3D.Tank { public class Turret : MonoBehaviour { - public void Move(Vector3 forwardDirection) + private Transform m_followingCamera; + + private void Awake() + { + // Get the transform of the main camera + if (Camera.main != null) + { + m_followingCamera = Camera.main.transform; + } + else + { + Debug.LogWarning("Warning: no main camera found. Tank needs a Camera tagged \"MainCamera\", for camera-relative controls."); + } + } + + private void Update() + { + } + + + private void FixedUpdate() { - transform.rotation = Quaternion.LookRotation(Vector3.Scale(forwardDirection, new Vector3(1, 0, 1))); + transform.eulerAngles = new Vector3(transform.eulerAngles.x, m_followingCamera.eulerAngles.y, transform.eulerAngles.z); } } }