AsteroidGame/Assets/Entities/Enemies/Scripts/EnemyMovement.cs

62 lines
1.4 KiB
C#

using System.Collections;
using UnityEngine;
namespace AsteroidGame.Entities.Enemies
{
public class EnemyMovement : MonoBehaviour
{
[Header("Parameters")]
[SerializeField] [Range(0f, 5f)] float _speed = 1f;
[SerializeField] int _damage = 1;
// [SerializeField] EnemyHandler enemyHandler;
// [SerializeField] ScoreHandler scoreHandler;
Vector3 _startPosition;
Vector3 _endPosition;
float _travelPercent = 0f;
private IEnumerator _followPath;
void Awake()
{
// enemyHandler = FindObjectOfType<EnemyHandler>();
// scoreHandler = FindObjectOfType<ScoreHandler>();
}
void OnEnable()
{
// enemyHandler.AddEnemyToAllEnemies(gameObject);
}
void RecalculatePath()
{
if (_followPath != null)
{
//Debug.Log("Stopping Coroutine");
StopCoroutine(_followPath);
}
}
void HandleReachedEndOfPath()
{
// scoreHandler.ModifyHealth(-damage);
// scoreHandler.ModifyWealth(-100);
// enemyHandler.RemoveEnemy(gameObject);
//Destroy(gameObject);
gameObject.SetActive(false);
}
private Vector3 GetVector3(Vector2Int coord)
{
return new Vector3((float)coord.x, 0f, (float)coord.y) * 10f;
}
}
}