SetDestination() public method

public SetDestination ( Vector3 target ) : bool
target Vector3
return bool
コード例 #1
0
ファイル: Clyde.cs プロジェクト: pwestrich/csc_4903_p2
 // 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);
     }
 }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        m_Trans = transform;
        m_Agent = m_Trans.GetComponent<NavMeshAgent>();

        m_Agent.SetDestination(new Vector3(0, 0, 0));
    }
コード例 #3
0
ファイル: Inky.cs プロジェクト: pwestrich/csc_4903_p2
 // Use this for initialization
 void OnEnable()
 {
     agent = GetComponent<NavMeshAgent> ();
     hunting = false;
     currentDestination = Random.Range (0, 3);
     agent.SetDestination (destinations[currentDestination].transform.position);
 }
コード例 #4
0
    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();
        }
    }
コード例 #5
0
ファイル: navigate.cs プロジェクト: guangxij/npc
	void Change()
	{
		target = GameObject.FindGameObjectWithTag ("dead").transform;
		
		nav = GetComponent <NavMeshAgent> ();
		nav.SetDestination (target.position);
	}
コード例 #6
0
 void Start()
 {
     GetComponent<Rigidbody>().freezeRotation = true;
     agent = gameObject.GetComponent<NavMeshAgent>();
     agent.updatePosition = false;
     agent.SetDestination(GameManager.Instance.player.transform.position);
 }
コード例 #7
0
ファイル: Blinky.cs プロジェクト: pwestrich/csc_4903_p2
 // Use this for initialization
 void OnEnable()
 {
     agent = GetComponent<NavMeshAgent> ();
     hunting = false;
     currentDestination = RandomNavSphere (transform.position, wanderRadius, -1);
     agent.SetDestination (currentDestination);
 }
コード例 #8
0
 void Awake()
 {
     nexus = GameObject.FindGameObjectWithTag ("nexus").transform;
         isRIP = false;
         nav = GetComponent <NavMeshAgent> ();
         nav.SetDestination (nexus.position);
 }
コード例 #9
0
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     PF = GetComponent<PathFind>();
     PF.OVRDest = true;
     agent.SetDestination(Points[0].position);
 }
コード例 #10
0
ファイル: BossAct3.cs プロジェクト: Iciraus/Heroes-Path
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     currentNavpoint = 0;
     agent.SetDestination(navpoints[currentNavpoint].transform.position);
     necromancer = other.gameObject.tag = "Necromancer";
 }
コード例 #11
0
ファイル: BasicAI.cs プロジェクト: s4mmc/BallGameProto
	// Use this for initialization
	void Start ()
    {
        navAgent = GetComponent<NavMeshAgent>();

        navAgent.SetDestination(ball.position);

	}
コード例 #12
0
ファイル: monsterAI.cs プロジェクト: ConjureETS/EscapeTheRoom
    // Use this for initialization
    void Start()
    {
        target = player.transform;

        agent = gameObject.GetComponent<NavMeshAgent> ();

        agent.SetDestination (target.position);
    }
コード例 #13
0
ファイル: navigate.cs プロジェクト: guangxij/npc
	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);
	}
コード例 #14
0
ファイル: Enemy.cs プロジェクト: Andy1994/Unity
	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);
	}
コード例 #15
0
ファイル: EnemyBasic.cs プロジェクト: RarCeth/SystemShutdown
 void Start()
 {
     rb = GetComponent <Rigidbody> ();
     myAgent = GetComponent <NavMeshAgent> ();
     baseLocal = GameObject.FindGameObjectWithTag ("Base").transform.position;
     myAgent.SetDestination (baseLocal);
     SetHealth ();
 }
コード例 #16
0
    // Use this for initialization
    void Start()
    {
        _navMeshAgent = GetComponent<NavMeshAgent> ();

        if (_location != null) {
            _navMeshAgent.SetDestination (_location);
        }
    }
コード例 #17
0
    // 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);
    }
コード例 #18
0
ファイル: Navigator.cs プロジェクト: adamtuliper/VampKid3D
    // 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);
    }
コード例 #19
0
	// 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;		
		}
	}
コード例 #20
0
ファイル: Wander.cs プロジェクト: MassonC/MyRTS
 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);
 }
コード例 #21
0
ファイル: AIPath.cs プロジェクト: vmohan7/Assassins
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     agent.updatePosition = true;
     agent.updateRotation = true;
     destination = this.gameObject.transform.position;
     agent.SetDestination (destination);
     onTempPath = false;
 }
コード例 #22
0
 // 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);
     }
 }
コード例 #23
0
ファイル: FleeState.cs プロジェクト: DavidZwit/MytheDAG2016
 public override void Enter()
 {
     inSaveZone = false;
     agent = GetComponent<NavMeshAgent>();
     agent.SetDestination(saveZone.position);
     agent.speed = 20;
     destination = agent.destination;
     StartCoroutine("toSaveZone");
 }
コード例 #24
0
		// 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);
						}
				}
		}
コード例 #25
0
ファイル: EnemyMove.cs プロジェクト: yutatanaka/Kotodama
  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>();
  }
コード例 #26
0
ファイル: StairRitual.cs プロジェクト: WEASEL4994/GameJam2016
 public void Action(NavMeshAgent aAgent)
 {
     Debug.Log(Counter);
     aAgent.SetDestination(m_Positions[Counter].transform.position);
     ++Counter;
     if(Counter > m_Positions.Length - 1)
     {
         Counter = 0;
     }
 }
コード例 #27
0
ファイル: navigate3.cs プロジェクト: haizhoul/Version10-13
 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);
 }
コード例 #28
0
	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);
		}
	}
コード例 #29
0
ファイル: Mover.cs プロジェクト: urgamedev/SugarRush
    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);
    }
コード例 #30
0
ファイル: navigate3.cs プロジェクト: haizhoul/Version10-13
    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);
    }
コード例 #31
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, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #32
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));
     }
 }
コード例 #33
0
 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));
     }
 }
コード例 #34
0
 public override void OnEnter()
 {
     agent = ownerDefault.GetComponent <UnityEngine.NavMeshAgent> ();
     agent.SetDestination(owner.GetVector3(destination));
     Finish();
 }
コード例 #35
0
 public override void OnExit()
 {
     agent.Stop();
     agent.SetDestination(owner.transform.position);
 }