Minor enemy scripts fixes
This commit is contained in:
parent
4ab6cc09c5
commit
2595283143
@ -47,19 +47,18 @@
|
||||
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\Scripts\Enemies' Scprits\Skeleton.cs" />
|
||||
<Compile Include="Assets\Scripts\Enemies' Scprits\Enemy.cs" />
|
||||
<Compile Include="Assets\Scripts\QuitGame.cs" />
|
||||
<Compile Include="Assets\Scripts\Inventory\InventoryManager.cs" />
|
||||
<Compile Include="Assets\Scripts\Item\Item.cs" />
|
||||
<Compile Include="Assets\Scripts\CamerFollow.cs" />
|
||||
<Compile Include="Assets\Scripts\SaveSoundSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\FloatValue.cs" />
|
||||
<Compile Include="Assets\breakable.cs" />
|
||||
<Compile Include="Assets\Scripts\Enemies' Scprits\PatrolBat.cs" />
|
||||
<Compile Include="Assets\Scripts\Item\PickableController.cs" />
|
||||
<Compile Include="Assets\Scripts\Objects' Scripts\Chest.cs" />
|
||||
<Compile Include="Assets\Scripts\Enemies' Scprits\Slimes.cs" />
|
||||
<Compile Include="Assets\Scripts\DoorBehaviour.cs" />
|
||||
<Compile Include="Assets\Scripts\Enemies' Scprits\PatrollingEnemy.cs" />
|
||||
<Compile Include="Assets\Scripts\ChangeScene.cs" />
|
||||
<Compile Include="Assets\Scripts\Player.cs" />
|
||||
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />
|
||||
|
@ -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
|
||||
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69ab2a73bdf94144c9b5b758d5361e50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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;
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5b132894dc32424c8b6d1ba97c27535
|
||||
guid: 5ebb8998660f8a44f8b4f3d17a50103f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -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<Rigidbody2D>();
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4421f6d37bca0b64aaf4e016121f133b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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<Rigidbody2D>();
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user