Question by
hendrickmiqueias · Jul 20, 2020 at 10:04 AM ·
programming
I can't think of a way to write this code
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class inimigo : MonoBehaviour { private GameObject player; private UnityEngine.AI.NavMeshAgent navMesh; public Animator inimigoanimation; // Start is called before the first frame update void Start() { player = GameObject.FindWithTag("Player"); navMesh = GetComponent ();
}
// Update is called once per frame
void Update()
{
{
if (Vector3.Distance(transform.position, player.transform.position) < 10f)
{
inimigoanimation.SetBool("player enter", true);
navMesh.destination = player.transform.position;
}
}
}
}
I want that after the movement (navMesh.destination = player.transform.position;) happens, the variable "player enter" receives false. only after
Comment
Your answer
Follow this Question
Related Questions
Need a 2D Rigid Body Controller Script 1 Answer
2 Issues with my SHUMP game 0 Answers
How to project a semi transparent copy of a gameobject? 0 Answers
How does this part of the script make sense? 3 Answers
Inheritance problem 1 Answer