I have been getting this error while coping a course and i dont know why.
This is my code :
using UnityEngine;
using RPG.Move;
using RPG.Core;
namespace RPG.Lupta
{
public class Luptator : MonoBehaviour, IActiune
{
[SerializeField] float distantaArma = 2f;
[SerializeField] float timpIntreAtacuri = 1f;
[SerializeField] float armaDauna = 5f;
Sanatate tinta;
float timpUltimulAtac = 0;
public void Update()
{
timpUltimulAtac += Time.deltaTime;
if (tinta == null) return;
if (tinta.EsteMort()) return;
if (!GetIsInRange())
{
GetComponent<Mover>().MutareCatre(tinta.transform.position);
}
else
{
GetComponent<Mover>().Cancel();
ComportamentLovitura();
}
}
private void ComportamentLovitura()
{
transform.LookAt(tinta.transform);
if (timpUltimulAtac > timpIntreAtacuri)
{
//declanseaza evenimentul Hit()
TriggerAtac();
timpUltimulAtac = 0;
}
}
private void TriggerAtac()
{
GetComponent<Animator>().ResetTrigger("stopAtac");
GetComponent<Animator>().SetTrigger("atac");
}
//este un event animatie
void Hit()
{
if (tinta == null ) { return; }
tinta.iaDaunele(armaDauna);
}
private bool GetIsInRange()
{
return Vector3.Distance(transform.position, tinta.transform.position) < distantaArma;
}
public bool PoateAtaca(GameObject tintaLupta)
{
if (tintaLupta == null) { return false; }
Sanatate tintaDeTest = tintaLupta.GetComponent<Sanatate>();
return tintaDeTest != null && !tintaDeTest.EsteMort();
}
public void Atac(GameObject tintaLupta)
{
GetComponent<ProgramareActiune>().IncepeActiune(this);
tinta = tintaLupta.GetComponent<Sanatate>();
}
public void Cancel()
{
StopAtac();
tinta = null;
}
private void StopAtac()
{
GetComponent<Animator>().ResetTrigger("atac");
GetComponent<Animator>().SetTrigger("stopAtac");
}
}
}
It says that the problem is in line 28 at the first code i put. which is :
GetComponent().MutareCatre(tinta.transform.position);
Does anyone know what the problem might be?[/CODE]