Enemy flip add

This commit is contained in:
kimrdd 2024-02-03 21:52:24 +01:00
parent ff8b050d93
commit a897dd65dc
21 changed files with 339 additions and 26 deletions

View File

@ -93,7 +93,7 @@ Animator:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 658931473633382931}
m_Enabled: 0
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 8c057960a463d234daf35d12e970f264, type: 2}
m_CullingMode: 0
@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 3477818934881411113}
m_Layer: 0
m_Name: Enemy1V1
m_TagString: Untagged
@ -243,4 +244,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &3477818934881411113
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -119,6 +119,7 @@ GameObject:
- component: {fileID: -4060921817738925561}
- component: {fileID: 1240337968825240287}
- component: {fileID: -7368324163293952402}
- component: {fileID: 1203571175389907979}
m_Layer: 0
m_Name: Enemy1V2
m_TagString: Untagged
@ -221,4 +222,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &1203571175389907979
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -119,6 +119,7 @@ GameObject:
- component: {fileID: 1169561095041589923}
- component: {fileID: -3565830332974631248}
- component: {fileID: -99408799291400877}
- component: {fileID: 7065122129502476799}
m_Layer: 0
m_Name: Enemy1V3
m_TagString: Untagged
@ -226,3 +227,15 @@ MonoBehaviour:
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &7065122129502476799
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 8407687426537136098}
m_Layer: 0
m_Name: Enemy2V1
m_TagString: Untagged
@ -243,4 +244,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &8407687426537136098
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 2239829156743597080}
m_Layer: 0
m_Name: Enemy2V2
m_TagString: Untagged
@ -243,4 +244,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &2239829156743597080
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 2593167518683313509}
m_Layer: 0
m_Name: Enemy2V3
m_TagString: Untagged
@ -243,4 +244,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &2593167518683313509
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 5601190281078907372}
m_Layer: 0
m_Name: Enemy3V1
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &5601190281078907372
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 5537633588480359369}
m_Layer: 0
m_Name: Enemy3V2
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &5537633588480359369
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 5342177024833758816}
m_Layer: 0
m_Name: Enemy3V3
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &5342177024833758816
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 6703538002322560484}
m_Layer: 0
m_Name: Enemy4V1
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &6703538002322560484
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 5189432348483020584}
m_Layer: 0
m_Name: Enemy4V2
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &5189432348483020584
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 8229201628275188815}
m_Layer: 0
m_Name: Enemy4V3
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &8229201628275188815
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 17691115352120009}
m_Layer: 0
m_Name: Enemy5V1
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &17691115352120009
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 893626435943606516}
m_Layer: 0
m_Name: Enemy5V2
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &893626435943606516
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 2019234432969631736}
m_Layer: 0
m_Name: Enemy5V3
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &2019234432969631736
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 4552190225719755244}
m_Layer: 0
m_Name: Enemy6V1
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &4552190225719755244
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 7803025104266690665}
m_Layer: 0
m_Name: Enemy6V2
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &7803025104266690665
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 944314729512195366}
- component: {fileID: 8373694659570615877}
- component: {fileID: -1793628155013383594}
- component: {fileID: 316906110964971930}
m_Layer: 0
m_Name: Enemy6V3
m_TagString: Untagged
@ -243,4 +244,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6a3ffc4a3af9e0243ac9ee0c995bb82f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
targets: []
ropeDistCheck: 1
ropeCheckMask:
serializedVersion: 2
m_Bits: 0
--- !u!114 &316906110964971930
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6905705041633878913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:
invert: 1

View File

@ -1110,10 +1110,6 @@ PrefabInstance:
propertyPath: m_Name
value: Enemy1V1
objectReference: {fileID: 0}
- target: {fileID: 7324983754635409392, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []

View File

@ -20,13 +20,14 @@ public class EnemyPathFinding : MonoBehaviour
}
private void Update()
{
if (targets.Length == 0) return;
Transform closestTarget = GetClosestTarget();
if (closestTarget == null) return;
// Make sure no rope parts are in front
Vector2 dir = closestTarget.position - transform.position;
if (Physics2D.Raycast(transform.position, dir.normalized, ropeDistCheck, ropeCheckMask))
return;
if (Physics2D.Raycast(transform.position, dir.normalized, ropeDistCheck, ropeCheckMask)) return;
agent.SetDestination(closestTarget.position);
}

View File

@ -2,6 +2,8 @@
public class SpriteMovementFlipper : MonoBehaviour
{
[SerializeField] private bool invert = false;
SpriteRenderer sp;
Vector3 prevPos;
@ -15,11 +17,11 @@ public class SpriteMovementFlipper : MonoBehaviour
{
if ((transform.position - prevPos).x > 0.1f)
{
sp.flipX = false;
sp.flipX = invert;
}
else if ((transform.position - prevPos).x < -0.1f)
{
sp.flipX = true;
sp.flipX = !invert;
}
prevPos = transform.position;