// Use this for initialization void OnEnable() { agent = GetComponent<NavMeshAgent> (); hunting = false; huntTimer = 0; if (Random.value < 0.5f) { currentDestination = Random.Range (0, destinations.Length - 1); agent.SetDestination (destinations [currentDestination].transform.position); } else { hunting = true; agent.SetDestination (targetPlayer.transform.position); currentDestination = Random.Range (0, destinations.Length - 1); } }
// Use this for initialization void Start() { m_Trans = transform; m_Agent = m_Trans.GetComponent<NavMeshAgent>(); m_Agent.SetDestination(new Vector3(0, 0, 0)); }
// Use this for initialization void OnEnable() { agent = GetComponent<NavMeshAgent> (); hunting = false; currentDestination = Random.Range (0, 3); agent.SetDestination (destinations[currentDestination].transform.position); }
void Update() { player = sCharactersManager.characters[0].gameObject; agent = GetComponent<NavMeshAgent>(); if(!gameObject.GetComponent<Character>().isDead) { if(agent.isOnNavMesh) { agent.SetDestination(player.transform.position); if(Vector3.Distance(player.transform.position,transform.position) > 1.5f) { agent.Resume(); }else{ agent.Stop(); } } if(Vector3.Distance(player.transform.position,transform.position) < 5) { Vector3 lookPos = new Vector3(player.transform.position.x, gameObject.transform.position.y, player.transform.position.z); gameObject.transform.LookAt(lookPos); } }else{ agent.Stop(); } }
void Change() { target = GameObject.FindGameObjectWithTag ("dead").transform; nav = GetComponent <NavMeshAgent> (); nav.SetDestination (target.position); }
void Start() { GetComponent<Rigidbody>().freezeRotation = true; agent = gameObject.GetComponent<NavMeshAgent>(); agent.updatePosition = false; agent.SetDestination(GameManager.Instance.player.transform.position); }
// Use this for initialization void OnEnable() { agent = GetComponent<NavMeshAgent> (); hunting = false; currentDestination = RandomNavSphere (transform.position, wanderRadius, -1); agent.SetDestination (currentDestination); }
void Awake() { nexus = GameObject.FindGameObjectWithTag ("nexus").transform; isRIP = false; nav = GetComponent <NavMeshAgent> (); nav.SetDestination (nexus.position); }
void Start() { agent = GetComponent<NavMeshAgent>(); PF = GetComponent<PathFind>(); PF.OVRDest = true; agent.SetDestination(Points[0].position); }
void Start() { agent = GetComponent<NavMeshAgent>(); currentNavpoint = 0; agent.SetDestination(navpoints[currentNavpoint].transform.position); necromancer = other.gameObject.tag = "Necromancer"; }
// Use this for initialization void Start () { navAgent = GetComponent<NavMeshAgent>(); navAgent.SetDestination(ball.position); }
// Use this for initialization void Start() { target = player.transform; agent = gameObject.GetComponent<NavMeshAgent> (); agent.SetDestination (target.position); }
public float Time = 3f; // How long between each spawn. void Awake () { // Set up the references. target = GameObject.FindGameObjectWithTag ("building3").transform; nav = GetComponent <NavMeshAgent> (); nav.SetDestination (target.position); }
void Start(){ m_transform = this.transform; m_ani = this.GetComponent<Animator> (); m_player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); m_agent = GetComponent<NavMeshAgent> (); //设置寻路目标 m_agent.SetDestination (m_player.transform.position); }
void Start() { rb = GetComponent <Rigidbody> (); myAgent = GetComponent <NavMeshAgent> (); baseLocal = GameObject.FindGameObjectWithTag ("Base").transform.position; myAgent.SetDestination (baseLocal); SetHealth (); }
// Use this for initialization void Start() { _navMeshAgent = GetComponent<NavMeshAgent> (); if (_location != null) { _navMeshAgent.SetDestination (_location); } }
// Use this for initialization void Start() { agent = GetComponent<NavMeshAgent>(); currentDestination = MyContext.WayPoints[Random.Range(0, MyContext.WayPoints.Length-1)]; agent.SetDestination(currentDestination); //подпишемся на событие обнаужения игрока Subscribe(EventAggregator.PlayerDetected, MoveToLastSpot); }
// Use this for initialization void Start() { _startingLocation = transform.position; _destination = GameObject.FindGameObjectWithTag(Tags.player).transform.position; _playerPosition = GameObject.FindGameObjectWithTag(Tags.player).transform; _navMeshAgent = GetComponent<NavMeshAgent>(); _navMeshAgent.SetDestination(_destination); }
// Update is called once per frame void Update () { agente = gameObject.GetComponent<NavMeshAgent> (); agente.SetDestination (destino.position); if (Vector3.Distance( agente.destination, agente.transform.position) <= agente.stoppingDistance) { chegouTaxi2 = true; } }
public Wander(NavMeshAgent passedAgent) { //Debug.Log("Wandering"); name = "wander"; agent = passedAgent; Vector3 target = new Vector3(Random.Range(-10,10), 0, Random.Range(-10,10)); target += agent.transform.position; agent.SetDestination(target); }
void Start() { agent = GetComponent<NavMeshAgent>(); agent.updatePosition = true; agent.updateRotation = true; destination = this.gameObject.transform.position; agent.SetDestination (destination); onTempPath = false; }
// Use this for initialization void Start() { nav = GetComponent<NavMeshAgent> (); GameObject[] cakes = GameObject.FindGameObjectsWithTag ("cake"); if (cakes.Length > 0) { testCake = cakes [Random.Range (0, cakes.Length)]; nav.SetDestination (testCake.transform.position); } }
public override void Enter() { inSaveZone = false; agent = GetComponent<NavMeshAgent>(); agent.SetDestination(saveZone.position); agent.speed = 20; destination = agent.destination; StartCoroutine("toSaveZone"); }
// Update is called once per frame void Update () { if (DestinosAnim.AndarViajante == true || DestinosTCPAnim.AndarViajante == true) { SeguirCarro = false; anim.SetBool ("Andar", true); for (int i=0; i<6; i++) { distancia = (int)Vector3.Distance (this.transform.position, NavDestino [i].transform.position); if (distancia < distanciaPeq) { distanciaPeq = distancia; numeroDestino = i; } } DestinosAnim.AndarViajante = false; DestinosTCPAnim.AndarViajante = false; } if (numeroDestino >= 0 && numeroDestino != 10) { agente = gameObject.GetComponent<NavMeshAgent> (); agente.SetDestination (NavDestino [numeroDestino].position); } // calculo da distancia entre o taxi e o destino distancia = (int)Vector3.Distance (Taxi.transform.position, destino.transform.position); if (distancia > 30){ // Rodar passageiro, para ficar de frente para o taxi this.transform.LookAt (referencia.transform); } // Caso a distancia seja <100m, o passageiro levanta a mao para chamar o taxi if (distancia > 2 && distancia < 100) { anim.SetBool ("ChamarTaxi", true); } else { anim.SetBool ("ChamarTaxi", false); } // AbrirPorta = true e definido quando o passageiro percorre todos os destinos // a volta do carro e chega ao destino 0 if (AbrirPorta == true) { time += Time.deltaTime; //contador de tempo if (time > 2.1 && time < 2.9) { RotacaoPorta = -40 * Time.deltaTime; // Abrir a Porta porta.transform.Rotate (new Vector3 (0, RotacaoPorta, 0)); } else if (time > 3.1 && time < 3.29) { RotacaoPorta = 170 * Time.deltaTime; // Fechar a Porta porta.transform.Rotate (new Vector3 (0, RotacaoPorta, 0)); entrouNoCarro = true; } else if (AbrirPorta == true && entrouNoCarro == true) { // Colocar a porta na posiçao correta, e mandar seguir o carro. porta.transform.localEulerAngles = new Vector3 (0, 0, 0); SeguirCarro = true; AbrirPorta = false; ActualizarDestino = true; //this.gameObject.SetActive(false); } } }
void Start() { _root = new Root(); foreach (var root in _rootList) { _root.Add(root); } _agent = GetComponent<NavMeshAgent>(); _agent.SetDestination(_root[_rootId].position); _originSpeed = _agent.speed; _renderer = GetComponentInChildren<SpriteRenderer>(); }
public void Action(NavMeshAgent aAgent) { Debug.Log(Counter); aAgent.SetDestination(m_Positions[Counter].transform.position); ++Counter; if(Counter > m_Positions.Length - 1) { Counter = 0; } }
void Change() { target = GameObject.FindGameObjectWithTag ("dead").transform; name = "Cool`"; //change head tag Cash.cash += 50; //adding money satisfaction.sat += 2; nav = GetComponent <NavMeshAgent> (); nav.SetDestination (target.position); DestroyObject(nav,10f); }
void Start () { path = new NavMeshPath(); agent = this.gameObject.GetComponent<NavMeshAgent>(); entrance = GameObject.Find ("Entrance"); despawnPoint = GameObject.Find ("CustomerDespawnPoint"); if (entrance != null) { agent.SetDestination(entrance.transform.position); } }
void Start() { target = GameObject.FindGameObjectWithTag ("Base"); currentSpeed = Random.Range(defaultSpeed-speedVariation, defaultSpeed+speedVariation); nav = GetComponent<NavMeshAgent> (); spawnPoint = transform.position; if(target != null) nav.SetDestination (target.transform.position); }
Transform target; // Reference to the player's position. #endregion Fields #region Methods void Awake() { player = GameObject.FindGameObjectWithTag("MainCamera"); camera = Camera.main; // Set up the references. target = GameObject.FindGameObjectWithTag ("building2").transform; nav = GetComponent <NavMeshAgent> (); nav.SetDestination (target.position); InvokeRepeating ("Change", Time, Time); }
static public int SetDestination(IntPtr l) { try { UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); var ret = self.SetDestination(a1); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int SetDestination(IntPtr l) { try { UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); var ret = self.SetDestination(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int SetDestination(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.NavMeshAgent obj = (UnityEngine.NavMeshAgent)ToLua.CheckObject(L, 1, typeof(UnityEngine.NavMeshAgent)); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); bool o = obj.SetDestination(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void OnEnter() { agent = ownerDefault.GetComponent <UnityEngine.NavMeshAgent> (); agent.SetDestination(owner.GetVector3(destination)); Finish(); }
public override void OnExit() { agent.Stop(); agent.SetDestination(owner.transform.position); }