public override void Execute() { //Si encuentro la bandera if (Vector3.Distance(_flag.transform.position, _brain.brainOwner.transform.position) <= 5) { OnFinishCommand?.Invoke(); return; } if (Vector3.Distance(_brain.desiredPosToGo, _brain.brainOwner.transform.position) <= 1f) { _brain.desiredPosToGo = GetPosRandom(40, _brain.brainOwner.transform); } if (_brain.brainOwner.GetComponent <NavMeshAgent>().velocity.Equals(Vector3.zero)) { _count -= Time.deltaTime; if (_count <= 0) { _count = 1; _brain.desiredPosToGo = GetPosRandom(40, _brain.brainOwner.transform); } } }
public override void Execute() { if (Vector3.Distance(_brain.desiredPosToGo, _brain.brainOwner.transform.position) <= 4) { OnFinishCommand?.Invoke(); return; } }