From 259528314393ea6e839397fca6defe0b3bdb7fe9 Mon Sep 17 00:00:00 2001 From: KrolMel Date: Wed, 18 May 2022 21:56:39 +0200 Subject: [PATCH] Minor enemy scripts fixes --- Assembly-CSharp.csproj | 5 +- Assets/Scenes/SampleScene.unity | 22 ++++---- .../Enemies' Scprits/PatrolBat.cs.meta | 11 ---- .../{PatrolBat.cs => PatrollingEnemy.cs} | 3 +- ...Slimes.cs.meta => PatrollingEnemy.cs.meta} | 2 +- Assets/Scripts/Enemies' Scprits/Skeleton.cs | 52 ------------------ .../Scripts/Enemies' Scprits/Skeleton.cs.meta | 11 ---- Assets/Scripts/Enemies' Scprits/Slimes.cs | 53 ------------------- 8 files changed, 15 insertions(+), 144 deletions(-) delete mode 100644 Assets/Scripts/Enemies' Scprits/PatrolBat.cs.meta rename Assets/Scripts/Enemies' Scprits/{PatrolBat.cs => PatrollingEnemy.cs} (93%) rename Assets/Scripts/Enemies' Scprits/{Slimes.cs.meta => PatrollingEnemy.cs.meta} (83%) delete mode 100644 Assets/Scripts/Enemies' Scprits/Skeleton.cs delete mode 100644 Assets/Scripts/Enemies' Scprits/Skeleton.cs.meta delete mode 100644 Assets/Scripts/Enemies' Scprits/Slimes.cs diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 2cf6cf01..b240f8b9 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -47,19 +47,18 @@ false - + - - + diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index ab24864a..3de0a32a 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -134,9 +134,9 @@ GameObject: - component: {fileID: 8620307} - component: {fileID: 8620306} - component: {fileID: 8620308} - - component: {fileID: 8620311} - component: {fileID: 8620310} - component: {fileID: 8620309} + - component: {fileID: 8620311} m_Layer: 0 m_Name: Bat_1 m_TagString: Untagged @@ -284,11 +284,11 @@ MonoBehaviour: m_GameObject: {fileID: 8620305} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 69ab2a73bdf94144c9b5b758d5361e50, type: 3} + m_Script: {fileID: 11500000, guid: 5ebb8998660f8a44f8b4f3d17a50103f, type: 3} m_Name: m_EditorClassIdentifier: moveSpeed: 4 - enemyName: Batman + enemyName: maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} health: 0 path: @@ -428,10 +428,10 @@ MonoBehaviour: m_GameObject: {fileID: 68076400} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4421f6d37bca0b64aaf4e016121f133b, type: 3} + m_Script: {fileID: 11500000, guid: 5ebb8998660f8a44f8b4f3d17a50103f, type: 3} m_Name: m_EditorClassIdentifier: - moveSpeed: 4 + moveSpeed: 6 enemyName: maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} health: 0 @@ -1001,11 +1001,11 @@ MonoBehaviour: m_GameObject: {fileID: 242009510} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 69ab2a73bdf94144c9b5b758d5361e50, type: 3} + m_Script: {fileID: 11500000, guid: 5ebb8998660f8a44f8b4f3d17a50103f, type: 3} m_Name: m_EditorClassIdentifier: moveSpeed: 4 - enemyName: Bat0 + enemyName: maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} health: 0 path: @@ -1998,10 +1998,10 @@ MonoBehaviour: m_GameObject: {fileID: 641696201} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b5b132894dc32424c8b6d1ba97c27535, type: 3} + m_Script: {fileID: 11500000, guid: 5ebb8998660f8a44f8b4f3d17a50103f, type: 3} m_Name: m_EditorClassIdentifier: - moveSpeed: 1.5 + moveSpeed: 3 enemyName: maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} health: 0 @@ -2203,10 +2203,10 @@ MonoBehaviour: m_GameObject: {fileID: 682072029} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b5b132894dc32424c8b6d1ba97c27535, type: 3} + m_Script: {fileID: 11500000, guid: 5ebb8998660f8a44f8b4f3d17a50103f, type: 3} m_Name: m_EditorClassIdentifier: - moveSpeed: 1.5 + moveSpeed: 3 enemyName: maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} health: 0 diff --git a/Assets/Scripts/Enemies' Scprits/PatrolBat.cs.meta b/Assets/Scripts/Enemies' Scprits/PatrolBat.cs.meta deleted file mode 100644 index 202ab95a..00000000 --- a/Assets/Scripts/Enemies' Scprits/PatrolBat.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69ab2a73bdf94144c9b5b758d5361e50 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Enemies' Scprits/PatrolBat.cs b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs similarity index 93% rename from Assets/Scripts/Enemies' Scprits/PatrolBat.cs rename to Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs index 5d616288..29d70279 100644 --- a/Assets/Scripts/Enemies' Scprits/PatrolBat.cs +++ b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs @@ -2,9 +2,8 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class PatrolBat : Enemy +public class PatrollingEnemy : Enemy { - public Transform[] path; public int currentPoint; public Transform currentGoal; diff --git a/Assets/Scripts/Enemies' Scprits/Slimes.cs.meta b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs.meta similarity index 83% rename from Assets/Scripts/Enemies' Scprits/Slimes.cs.meta rename to Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs.meta index 39a25cfd..29fe635b 100644 --- a/Assets/Scripts/Enemies' Scprits/Slimes.cs.meta +++ b/Assets/Scripts/Enemies' Scprits/PatrollingEnemy.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b5b132894dc32424c8b6d1ba97c27535 +guid: 5ebb8998660f8a44f8b4f3d17a50103f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Enemies' Scprits/Skeleton.cs b/Assets/Scripts/Enemies' Scprits/Skeleton.cs deleted file mode 100644 index bbd15a87..00000000 --- a/Assets/Scripts/Enemies' Scprits/Skeleton.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Skeleton : Enemy -{ - public Transform[] path; - public int currentPoint; - public Transform currentGoal; - public float roundingDistance; - - private Rigidbody2D myRigidbody; - //public Transform target; - public Animator anim; - - // Start is called before the first frame update - void Start() - { - myRigidbody = GetComponent(); - anim = GetComponent(); - } - - // Update is called once per frame - void Update() - { - if (Vector3.Distance(transform.position, path[currentPoint].position) > roundingDistance) - { - Vector3 temp = Vector3.MoveTowards(transform.position, path[currentPoint].position, moveSpeed * Time.deltaTime); - //changeAnim(temp - transform.position); - myRigidbody.MovePosition(temp); - } - else - { - changeGoal(); - } - - } - - private void changeGoal() - { - if (currentPoint == path.Length - 1) - { - currentPoint = 0; - currentGoal = path[0]; - } - else - { - currentPoint++; - currentGoal = path[currentPoint]; - } - } -} diff --git a/Assets/Scripts/Enemies' Scprits/Skeleton.cs.meta b/Assets/Scripts/Enemies' Scprits/Skeleton.cs.meta deleted file mode 100644 index 58fe883a..00000000 --- a/Assets/Scripts/Enemies' Scprits/Skeleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4421f6d37bca0b64aaf4e016121f133b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Enemies' Scprits/Slimes.cs b/Assets/Scripts/Enemies' Scprits/Slimes.cs deleted file mode 100644 index da240815..00000000 --- a/Assets/Scripts/Enemies' Scprits/Slimes.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Slimes : Enemy -{ - - public Transform[] path; - public int currentPoint; - public Transform currentGoal; - public float roundingDistance; - - private Rigidbody2D myRigidbody; - //public Transform target; - public Animator anim; - - // Start is called before the first frame update - void Start() - { - myRigidbody = GetComponent(); - anim = GetComponent(); - } - - // Update is called once per frame - void Update() - { - if (Vector3.Distance(transform.position, path[currentPoint].position) > roundingDistance) - { - Vector3 temp = Vector3.MoveTowards(transform.position, path[currentPoint].position, moveSpeed * Time.deltaTime); - //changeAnim(temp - transform.position); - myRigidbody.MovePosition(temp); - } - else - { - changeGoal(); - } - - } - - private void changeGoal() - { - if (currentPoint == path.Length - 1) - { - currentPoint = 0; - currentGoal = path[0]; - } - else - { - currentPoint++; - currentGoal = path[currentPoint]; - } - } -}