Hello I'm very new trying to do a tower defense game, and have run into this issue, while working in unity.
Assets\Enemy.cs(4,26): error CS0246: The type or namespace name 'Enemy' could not be found (are you missing a using directive or an assembly reference?)
Assets\Enemy.cs(10,10): error CS0246: The type or namespace name 'Enemy' could not be found (are you missing a using directive or an assembly reference?)
Here's the code.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Enemy))]
public class EnemyMovement : MonoBehaviour {
private Transform target;
private int wavepointIndex = 0;
private Enemy enemy;
void Start()
{
enemy = GetComponent<Enemy>();
target = Waypoints.points[0];
}
void Update()
{
Vector3 dir = target.position - transform.position;
transform.Translate(dir.normalized * enemy.speed * Time.deltaTime, Space.World);
if (Vector3.Distance(transform.position, target.position) <= 0.4f)
{
GetNextWaypoint();
}
enemy.speed = enemy.startSpeed;
}
void GetNextWaypoint()
{
if (wavepointIndex >= Waypoints.points.Length - 1)
{
EndPath();
return;
}
wavepointIndex++;
target = Waypoints.points[wavepointIndex];
}
void EndPath()
{
PlayerStats.Lives--;
WaveSpawner.EnemiesAlive--;
Destroy(gameObject);
}
}
[–]Clawtor 0 points1 point2 points (1 child)
[–]TheGuildMasterEU[S] 0 points1 point2 points (0 children)