mirror of
https://github.com/Steffo99/bleach-beach.git
synced 2024-12-04 19:04:19 +00:00
Add basic AI
This commit is contained in:
parent
1987498444
commit
7e2278dc7c
11 changed files with 483 additions and 47 deletions
169
Assets/Prefabs/Enemy.prefab
generated
Normal file
169
Assets/Prefabs/Enemy.prefab
generated
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1001 &100100000
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications: []
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 0}
|
||||||
|
m_RootGameObject: {fileID: 1195403025493360}
|
||||||
|
m_IsPrefabAsset: 1
|
||||||
|
--- !u!1 &1195403025493360
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4056561897088050}
|
||||||
|
- component: {fileID: 212864900431362760}
|
||||||
|
- component: {fileID: 50337207293964320}
|
||||||
|
- component: {fileID: 61036691294505782}
|
||||||
|
- component: {fileID: 114327601929205558}
|
||||||
|
- component: {fileID: 114122030605112200}
|
||||||
|
m_Layer: 9
|
||||||
|
m_Name: Enemy
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4056561897088050
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 21.96, y: 36.57, z: 0}
|
||||||
|
m_LocalScale: {x: 2.648, y: 0.903, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!50 &50337207293964320
|
||||||
|
Rigidbody2D:
|
||||||
|
serializedVersion: 4
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_BodyType: 0
|
||||||
|
m_Simulated: 1
|
||||||
|
m_UseFullKinematicContacts: 0
|
||||||
|
m_UseAutoMass: 1
|
||||||
|
m_Mass: 2.391144
|
||||||
|
m_LinearDrag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_GravityScale: 1
|
||||||
|
m_Material: {fileID: 6200000, guid: 704f912fbe8bba74ebedd5a5f7bff08f, type: 2}
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_SleepingMode: 1
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
--- !u!61 &61036691294505782
|
||||||
|
BoxCollider2D:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Density: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_SpriteTilingProperty:
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
pivot: {x: 0.5, y: 0.5}
|
||||||
|
oldSize: {x: 1, y: 1}
|
||||||
|
newSize: {x: 1, y: 1}
|
||||||
|
adaptiveTilingThreshold: 0.5
|
||||||
|
drawMode: 0
|
||||||
|
adaptiveTiling: 0
|
||||||
|
m_AutoTiling: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1}
|
||||||
|
m_EdgeRadius: 0
|
||||||
|
--- !u!114 &114122030605112200
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e1de68aef1b6a89419a36f3455e25bf3, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
fishCaught: 0
|
||||||
|
--- !u!114 &114327601929205558
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 705389440a45f5f48aa5ede6519821e4, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
maximumDistanceFromFish: 1
|
||||||
|
timeBeforeChangingTarget: 10
|
||||||
|
horizontalSpeed: 5
|
||||||
|
verticalSpeed: 30
|
||||||
|
shootForce: 5
|
||||||
|
harpoon: {fileID: 1737609814504882, guid: 288f16ae5eaa16440b89da431723b1c2, type: 2}
|
||||||
|
harpoonAvailable: 1
|
||||||
|
maxJetFuel: 1
|
||||||
|
jetFuelRechargeSpeed: 0.1
|
||||||
|
--- !u!212 &212864900431362760
|
||||||
|
SpriteRenderer:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 1195403025493360}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RenderingLayerMask: 4294967295
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10754, 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_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 0
|
||||||
|
m_SelectedEditorRenderState: 0
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_Sprite: {fileID: 21300000, guid: be5eaf9abd3481b489d582a8f1a41508, type: 3}
|
||||||
|
m_Color: {r: 1, g: 0, b: 0, a: 1}
|
||||||
|
m_FlipX: 0
|
||||||
|
m_FlipY: 0
|
||||||
|
m_DrawMode: 0
|
||||||
|
m_Size: {x: 1, y: 1}
|
||||||
|
m_AdaptiveModeThreshold: 0.5
|
||||||
|
m_SpriteTileMode: 0
|
||||||
|
m_WasSpriteAssigned: 1
|
||||||
|
m_MaskInteraction: 0
|
||||||
|
m_SpriteSortPoint: 0
|
8
Assets/Prefabs/Enemy.prefab.meta
generated
Normal file
8
Assets/Prefabs/Enemy.prefab.meta
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8a1e5fa769b403340be7a2808b56d69c
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
4
Assets/Prefabs/Harpoon.prefab
generated
4
Assets/Prefabs/Harpoon.prefab
generated
|
@ -21,7 +21,7 @@ GameObject:
|
||||||
- component: {fileID: 4347951085211458}
|
- component: {fileID: 4347951085211458}
|
||||||
- component: {fileID: 120926356996093036}
|
- component: {fileID: 120926356996093036}
|
||||||
- component: {fileID: 114113591002818490}
|
- component: {fileID: 114113591002818490}
|
||||||
m_Layer: 8
|
m_Layer: 0
|
||||||
m_Name: Chain
|
m_Name: Chain
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
@ -40,7 +40,7 @@ GameObject:
|
||||||
- component: {fileID: 50840653617852040}
|
- component: {fileID: 50840653617852040}
|
||||||
- component: {fileID: 114633804764434460}
|
- component: {fileID: 114633804764434460}
|
||||||
- component: {fileID: 61123955855276598}
|
- component: {fileID: 61123955855276598}
|
||||||
m_Layer: 8
|
m_Layer: 0
|
||||||
m_Name: Harpoon
|
m_Name: Harpoon
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
|
|
8
Assets/Prefabs/Ship.prefab
generated
8
Assets/Prefabs/Ship.prefab
generated
|
@ -85,7 +85,7 @@ Transform:
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
m_GameObject: {fileID: 1506768218425990}
|
m_GameObject: {fileID: 1506768218425990}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 4.27, y: 42.06, z: 0}
|
m_LocalPosition: {x: 4.27, y: 40.291958, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4419769467158982}
|
- {fileID: 4419769467158982}
|
||||||
|
@ -126,7 +126,7 @@ Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 100100000}
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
m_GameObject: {fileID: 1884810528837284}
|
m_GameObject: {fileID: 1884810528837284}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: 0.4695518, w: 0.88290495}
|
||||||
m_LocalPosition: {x: -0.08000004, y: 0.61999893, z: 0}
|
m_LocalPosition: {x: -0.08000004, y: 0.61999893, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
@ -263,7 +263,7 @@ SpriteRenderer:
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_Sprite: {fileID: 21300000, guid: bdd08b099cc1c614096f43a9ccf99b59, type: 3}
|
m_Sprite: {fileID: 21300000, guid: bdd08b099cc1c614096f43a9ccf99b59, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 1
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
m_DrawMode: 0
|
m_DrawMode: 0
|
||||||
m_Size: {x: 0.48, y: 1.02}
|
m_Size: {x: 0.48, y: 1.02}
|
||||||
|
@ -309,7 +309,7 @@ SpriteRenderer:
|
||||||
m_SortingOrder: 2
|
m_SortingOrder: 2
|
||||||
m_Sprite: {fileID: 21300000, guid: 1f841006c9147454d8eca3d3cae86c0f, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 1f841006c9147454d8eca3d3cae86c0f, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 1
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
m_DrawMode: 0
|
m_DrawMode: 0
|
||||||
m_Size: {x: 1.34, y: 0.65}
|
m_Size: {x: 1.34, y: 0.65}
|
||||||
|
|
178
Assets/Scenes/Game.unity
generated
178
Assets/Scenes/Game.unity
generated
|
@ -150,7 +150,7 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 11
|
value: 12
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -212,6 +212,16 @@ Prefab:
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Fish Spawner (1)
|
value: Fish Spawner (1)
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: spawnTime
|
||||||
|
value: 60
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: randomFactor
|
||||||
|
value: 30
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
|
@ -252,66 +262,56 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4978811670595372, guid: 633eed510cb97614896a65613c2eb772, type: 2}
|
- target: {fileID: 4978811670595372, guid: 633eed510cb97614896a65613c2eb772, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 4
|
value: 6
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 633eed510cb97614896a65613c2eb772, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 633eed510cb97614896a65613c2eb772, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
--- !u!1001 &284866319
|
--- !u!1001 &317854633
|
||||||
Prefab:
|
Prefab:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 7.9
|
value: 21.96
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 29.9
|
value: 36.57
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 12
|
value: 2
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
- target: {fileID: 1195403025493360, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
type: 2}
|
|
||||||
propertyPath: sea
|
|
||||||
value:
|
|
||||||
objectReference: {fileID: 2008841353}
|
|
||||||
- target: {fileID: 1634593922401586, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Fish Spawner (5)
|
value: Enemy (1)
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
|
||||||
type: 2}
|
|
||||||
propertyPath: spawnTime
|
|
||||||
value: 20
|
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
--- !u!1001 &391017218
|
--- !u!1001 &391017218
|
||||||
Prefab:
|
Prefab:
|
||||||
|
@ -350,7 +350,7 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2}
|
- target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 2
|
value: 4
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114070643257783382, guid: acb6270a21e7fa744878210a4df90d27,
|
- target: {fileID: 114070643257783382, guid: acb6270a21e7fa744878210a4df90d27,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -447,7 +447,7 @@ RectTransform:
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 949267804}
|
- {fileID: 949267804}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 20
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
|
@ -505,7 +505,12 @@ Prefab:
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
type: 2}
|
type: 2}
|
||||||
propertyPath: spawnTime
|
propertyPath: spawnTime
|
||||||
value: 35
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: randomFactor
|
||||||
|
value: 10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
|
@ -547,7 +552,7 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4023639078503100, guid: 0514a38f22bae454d821a12517a141c4, type: 2}
|
- target: {fileID: 4023639078503100, guid: 0514a38f22bae454d821a12517a141c4, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 3
|
value: 5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0514a38f22bae454d821a12517a141c4, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 0514a38f22bae454d821a12517a141c4, type: 2}
|
||||||
|
@ -782,6 +787,16 @@ Prefab:
|
||||||
propertyPath: sea
|
propertyPath: sea
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 2008841353}
|
objectReference: {fileID: 2008841353}
|
||||||
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: spawnTime
|
||||||
|
value: 60
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: randomFactor
|
||||||
|
value: 30
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
|
@ -841,6 +856,52 @@ Prefab:
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
|
--- !u!1001 &1105789933
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 39.292458
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 36.612633
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1195403025493360, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Enemy (2)
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
m_IsPrefabAsset: 0
|
||||||
--- !u!1 &1147089289
|
--- !u!1 &1147089289
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -901,7 +962,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 9
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &1240811157
|
--- !u!1001 &1240811157
|
||||||
Prefab:
|
Prefab:
|
||||||
|
@ -940,7 +1001,7 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 9
|
value: 10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -991,7 +1052,12 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2}
|
- target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 1
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 212928515413584804, guid: 1cf703958a669d942a42326499701367,
|
||||||
|
type: 2}
|
||||||
|
propertyPath: m_FlipX
|
||||||
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 1cf703958a669d942a42326499701367, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 1cf703958a669d942a42326499701367, type: 2}
|
||||||
|
@ -1150,7 +1216,7 @@ Prefab:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
- target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 10
|
value: 11
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
- target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -1169,6 +1235,48 @@ Prefab:
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2}
|
||||||
m_IsPrefabAsset: 0
|
m_IsPrefabAsset: 0
|
||||||
|
--- !u!1001 &1861714896
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: -31.72
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 37.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4056561897088050, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 19
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 8a1e5fa769b403340be7a2808b56d69c, type: 2}
|
||||||
|
m_IsPrefabAsset: 0
|
||||||
--- !u!1 &2008841353 stripped
|
--- !u!1 &2008841353 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 1259758189242624, guid: 4dc0408b236da9847b1c799161bbd70a,
|
m_CorrespondingSourceObject: {fileID: 1259758189242624, guid: 4dc0408b236da9847b1c799161bbd70a,
|
||||||
|
|
|
@ -19,7 +19,9 @@ public class Cannon : MonoBehaviour {
|
||||||
{
|
{
|
||||||
hullSpriteRenderer = hull.GetComponent<SpriteRenderer>();
|
hullSpriteRenderer = hull.GetComponent<SpriteRenderer>();
|
||||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||||
|
//Disable enemy and player collisions
|
||||||
Physics2D.IgnoreLayerCollision(8, 8);
|
Physics2D.IgnoreLayerCollision(8, 8);
|
||||||
|
Physics2D.IgnoreLayerCollision(9, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update ()
|
private void Update ()
|
||||||
|
@ -41,6 +43,7 @@ public class Cannon : MonoBehaviour {
|
||||||
harpoonInstance.transform.rotation = transform.rotation;
|
harpoonInstance.transform.rotation = transform.rotation;
|
||||||
harpoonInstance.GetComponent<Rigidbody2D>().AddForce(direction * force);
|
harpoonInstance.GetComponent<Rigidbody2D>().AddForce(direction * force);
|
||||||
harpoonInstance.GetComponent<SpriteRenderer>().flipX = spriteRenderer.flipX;
|
harpoonInstance.GetComponent<SpriteRenderer>().flipX = spriteRenderer.flipX;
|
||||||
|
harpoonInstance.layer = 8;
|
||||||
Linker linker = harpoonInstance.GetComponentInChildren<Linker>();
|
Linker linker = harpoonInstance.GetComponentInChildren<Linker>();
|
||||||
linker.firstObject = gameObject;
|
linker.firstObject = gameObject;
|
||||||
linker.secondObject = harpoonInstance;
|
linker.secondObject = harpoonInstance;
|
||||||
|
|
129
Assets/Scripts/EnemyShipAi.cs
Normal file
129
Assets/Scripts/EnemyShipAi.cs
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class EnemyShipAi : MonoBehaviour {
|
||||||
|
|
||||||
|
public float maximumDistanceFromFish = 2f;
|
||||||
|
public float timeBeforeChangingTarget = 10f;
|
||||||
|
public float horizontalSpeed = 5f;
|
||||||
|
public float verticalSpeed = 30f;
|
||||||
|
public float shootForce = 5f;
|
||||||
|
public GameObject harpoon;
|
||||||
|
public bool harpoonAvailable = true;
|
||||||
|
public float maxJetFuel = 2f;
|
||||||
|
public float jetFuelRechargeSpeed = 0.1f;
|
||||||
|
|
||||||
|
private GameObject target = null;
|
||||||
|
private Rigidbody2D rb;
|
||||||
|
private SpriteRenderer spriteRenderer;
|
||||||
|
private float timeSinceLastTarget = 0f;
|
||||||
|
private float jetFuel;
|
||||||
|
private bool usingJet;
|
||||||
|
|
||||||
|
void Start () {
|
||||||
|
rb = GetComponent<Rigidbody2D>();
|
||||||
|
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||||
|
jetFuel = maxJetFuel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update () {
|
||||||
|
timeBeforeChangingTarget += Time.deltaTime;
|
||||||
|
//Find a target fish
|
||||||
|
if(target == null || timeSinceLastTarget > timeBeforeChangingTarget)
|
||||||
|
{
|
||||||
|
if(target != null)
|
||||||
|
{
|
||||||
|
target.GetComponent<FishAi>().targetedBy = null;
|
||||||
|
}
|
||||||
|
target = FindClosestFish(GameObject.FindGameObjectsWithTag("Fish"));
|
||||||
|
if (target != null)
|
||||||
|
{
|
||||||
|
target.GetComponent<FishAi>().targetedBy = gameObject;
|
||||||
|
}
|
||||||
|
timeBeforeChangingTarget = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedUpdate()
|
||||||
|
{
|
||||||
|
//If the bot has a target
|
||||||
|
if(target != null)
|
||||||
|
{
|
||||||
|
//Slow down when near the fish
|
||||||
|
float power = Mathf.Clamp((Mathf.Abs(transform.position.x - target.transform.position.x) / maximumDistanceFromFish) - 1f, 0f, 1f);
|
||||||
|
//Shoot an harpoon if it's close enough and it's available
|
||||||
|
if (power == 0f && harpoonAvailable)
|
||||||
|
{
|
||||||
|
//Disable the jetpack
|
||||||
|
usingJet = false;
|
||||||
|
//Find the direction between the fish and the ship
|
||||||
|
Vector3 direction = (target.transform.position - transform.position).normalized;
|
||||||
|
//Shoot the harpoon
|
||||||
|
GameObject harpoonInstance = Instantiate(harpoon);
|
||||||
|
harpoonInstance.transform.position = transform.position + direction;
|
||||||
|
harpoonInstance.transform.rotation = transform.rotation;
|
||||||
|
harpoonInstance.GetComponent<Rigidbody2D>().AddForce(direction * shootForce);
|
||||||
|
harpoonInstance.GetComponent<SpriteRenderer>().flipX = spriteRenderer.flipX;
|
||||||
|
harpoonInstance.layer = 9;
|
||||||
|
Linker linker = harpoonInstance.GetComponentInChildren<Linker>();
|
||||||
|
linker.firstObject = gameObject;
|
||||||
|
linker.secondObject = harpoonInstance;
|
||||||
|
harpoonAvailable = false;
|
||||||
|
}
|
||||||
|
//Apply a force towards that direction if too far away
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Right
|
||||||
|
if (transform.position.x - target.transform.position.x < 0f)
|
||||||
|
{
|
||||||
|
rb.AddForce(Vector2.right * horizontalSpeed * power);
|
||||||
|
spriteRenderer.flipX = true;
|
||||||
|
}
|
||||||
|
//Left
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb.AddForce(Vector2.right * -horizontalSpeed * power);
|
||||||
|
spriteRenderer.flipX = false;
|
||||||
|
}
|
||||||
|
//Enable the jetpack
|
||||||
|
if(jetFuel == maxJetFuel)
|
||||||
|
{
|
||||||
|
usingJet = true;
|
||||||
|
}
|
||||||
|
//Use the jetpack
|
||||||
|
if(usingJet)
|
||||||
|
{
|
||||||
|
jetFuel -= Time.fixedDeltaTime;
|
||||||
|
rb.AddForce(Vector2.up * verticalSpeed);
|
||||||
|
if(jetFuel <= 0)
|
||||||
|
{
|
||||||
|
usingJet = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jetFuel = Mathf.Clamp(jetFuel + Time.fixedDeltaTime * jetFuelRechargeSpeed, 0f, maxJetFuel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject FindClosestFish(GameObject[] fish)
|
||||||
|
{
|
||||||
|
GameObject result = null;
|
||||||
|
float minimumDistance = Mathf.Infinity;
|
||||||
|
foreach (GameObject fishInstance in fish)
|
||||||
|
{
|
||||||
|
if (fishInstance.GetComponent<FishAi>().targetedBy != null) continue;
|
||||||
|
float distance = Vector3.Distance(fishInstance.transform.position, transform.position);
|
||||||
|
if (distance < minimumDistance)
|
||||||
|
{
|
||||||
|
minimumDistance = distance;
|
||||||
|
result = fishInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
Assets/Scripts/EnemyShipAi.cs.meta
generated
Normal file
11
Assets/Scripts/EnemyShipAi.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 705389440a45f5f48aa5ede6519821e4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -8,6 +8,7 @@ public class FishAi : MonoBehaviour {
|
||||||
public float speed = 2f;
|
public float speed = 2f;
|
||||||
public GameObject hook = null;
|
public GameObject hook = null;
|
||||||
public GameObject sea;
|
public GameObject sea;
|
||||||
|
public GameObject targetedBy;
|
||||||
private Vector3 direction;
|
private Vector3 direction;
|
||||||
private Rigidbody2D rb;
|
private Rigidbody2D rb;
|
||||||
|
|
||||||
|
|
|
@ -27,18 +27,25 @@ public class Harpoon : MonoBehaviour {
|
||||||
{
|
{
|
||||||
if (transform.position.y > linker.firstObject.transform.position.y)
|
if (transform.position.y > linker.firstObject.transform.position.y)
|
||||||
{
|
{
|
||||||
|
|
||||||
rb.MoveRotation(Vector2.Angle(transform.position - linker.firstObject.transform.position, Vector2.right) - 90f);
|
rb.MoveRotation(Vector2.Angle(transform.position - linker.firstObject.transform.position, Vector2.right) - 90f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
rb.MoveRotation(-Vector2.Angle(transform.position - linker.firstObject.transform.position, Vector2.right) - 90f);
|
rb.MoveRotation(-Vector2.Angle(transform.position - linker.firstObject.transform.position, Vector2.right) - 90f);
|
||||||
}
|
}
|
||||||
rb.MovePosition(Vector3.MoveTowards(transform.position, linker.firstObject.transform.position, returnSpeed * Time.deltaTime));
|
rb.MovePosition(Vector3.MoveTowards(transform.position, linker.firstObject.transform.position, returnSpeed * Time.deltaTime));
|
||||||
if(Vector3.Distance(transform.position, linker.firstObject.transform.position) < 0.2f)
|
if(Vector3.Distance(transform.position, linker.firstObject.transform.position) < 0.2f)
|
||||||
{
|
{
|
||||||
linker.firstObject.GetComponent<Cannon>().harpoonAvailable = true;
|
Cannon cannon = linker.firstObject.GetComponent<Cannon>();
|
||||||
|
if(cannon != null)
|
||||||
|
{
|
||||||
|
cannon.harpoonAvailable = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnemyShipAi enemyShipAi = linker.firstObject.GetComponent<EnemyShipAi>();
|
||||||
|
enemyShipAi.harpoonAvailable = true;
|
||||||
|
}
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@ public class PlayerMovement : MonoBehaviour {
|
||||||
|
|
||||||
private Rigidbody2D rb;
|
private Rigidbody2D rb;
|
||||||
public GameObject hull;
|
public GameObject hull;
|
||||||
public float horizontalShipSpeed = 50;
|
public float horizontalShipSpeed = 5f;
|
||||||
public float verticalShipSpeed = 20;
|
public float verticalShipSpeed = 30;
|
||||||
public float maxJetFuel = 2f;
|
public float maxJetFuel = 2f;
|
||||||
public float jetFuelRechargeSpeed = 0.5f;
|
public float jetFuelRechargeSpeed = 0.1f;
|
||||||
private float jetFuel;
|
private float jetFuel;
|
||||||
|
|
||||||
void Start () {
|
void Start () {
|
||||||
|
|
Loading…
Reference in a new issue