Stop() public method

public Stop ( ) : void
return void
コード例 #1
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();
        }
    }
コード例 #2
0
 static public int Stop(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
             self.Stop();
             return(0);
         }
         else if (argc == 2)
         {
             UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
             System.Boolean           a1;
             checkType(l, 2, out a1);
             self.Stop(a1);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #3
0
 static public int Stop(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
             self.Stop();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
             System.Boolean           a1;
             checkType(l, 2, out a1);
             self.Stop(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #4
0
    protected override void StartVirtual()
    {
        base.StartVirtual ();

        m_Agent = GetComponent<NavMeshAgent>();
        m_Agent.Stop ();

        m_Attack = GetComponent<AttackState>();
    }
コード例 #5
0
ファイル: Human.cs プロジェクト: ralphlizard/HotPatata
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad (this);
     startPos = transform.position;
     startRot = transform.rotation;
     anim = GetComponent<Animator> ();
     agent = GetComponent<NavMeshAgent> ();
     minDistance = agent.stoppingDistance;
     agent.Stop();
 }
コード例 #6
0
 static public int Stop(IntPtr l)
 {
     try {
         UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
         self.Stop();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #7
0
 static public int Stop(IntPtr l)
 {
     try {
         UnityEngine.NavMeshAgent self = (UnityEngine.NavMeshAgent)checkSelf(l);
         self.Stop();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #8
0
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
        agent.autoBraking = true;
        agent.autoRepath = true;
        agent.Stop();

        target = agent.gameObject.transform.position; // First "target" should be its current position.
        agent.SetDestination(target);

        active = false;
    }
コード例 #9
0
 static int Stop(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.NavMeshAgent obj = (UnityEngine.NavMeshAgent)ToLua.CheckObject(L, 1, typeof(UnityEngine.NavMeshAgent));
         obj.Stop();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #10
0
ファイル: Enemy.cs プロジェクト: DanielParra159/GGJ2016
	// Use this for initialization
	void Start () {
		myTransform = transform;
		target = GameManager.instance.hero.transform;
		agent = GetComponent<NavMeshAgent> ();

		// Disparos
		if (!isSeeker) {
			shootsPool.Reset ();
			agent.Stop ();
		} else {
//			agent.updatePosition = true;
			agent.updateRotation = false;
		}

        life = gameObject.GetComponent<Life>();
        life.registerOnDead(onDead);
        life.registerOnDamage(onDamage);
	}
コード例 #11
0
    void Attacking()
    {
        if (IsAttacking)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Player.position - transform.position), ease * Time.deltaTime);

            //Shoot
            nav.Stop();
            if (Time.time > nextFire && playerHealth.currentHealth > 0)
            {
                nextFire = Time.time + fireRate;

                Shoot = (Rigidbody)Instantiate(Bullet, SpawnPoint.position, SpawnPoint.rotation);
                Shoot.AddForce(SpawnPoint.forward * 5000);
                AudioSource.PlayClipAtPoint(shotClip, SpawnPoint.position);
            }
        }
    }
コード例 #12
0
  void OnTriggerStay (Collider objecto)
	{
		//si el ladron entro en el sphere collider
		if(objecto.gameObject.tag=="ladron")
		{
			//obtiene el componente animator del Ladron
			animator_ladron = objecto.GetComponent<Collider>().GetComponent<Animator>();
			//obtiene el componente navmeshagent del ladron
			agente_ladron = objecto.GetComponent<Collider>().GetComponent<NavMeshAgent>();
			// Create a vector from the enemy to the player and store the angle between it and forward.
			Vector3 direccion = objecto.transform.position - transform.position;
			float angulo = Vector3.Angle(direccion,transform.forward);
			
			// If the angle between forward and where the player is, is less than half the angle of view...
			if(angulo < angulo_de_vision * 0.5f)
			{
				distancia = Vector3.Distance(transform.position, objecto.GetComponent<Collider>().transform.position);
			    agente.SetDestination(objecto.GetComponent<Collider>().transform.position);
			    animator.SetBool("correr",true);
				if(distancia<=3 && atrapado == false){
					contar_ladrones+=1;
					l_ladrones.text=contar_ladrones.ToString();
					animator_ladron.SetBool("morir",true);
					objecto.gameObject.tag="muerto";
					objecto.GetComponent<SphereCollider>().enabled=false;
					agente_ladron.Stop();
					agente_ladron.speed = 0;
				
				}

			}
		

		}	else{
			animator.SetBool("correr",false);
			atrapado=false;
		}

	}
コード例 #13
0
ファイル: GirlScript.cs プロジェクト: MaDumont/LesVoyeurs
    void Start()
    {
        GameManager.getInstance ().addGuardListener (this);
        anim = GetComponent<Animator> ();
        agent = GetComponent<NavMeshAgent>();
        eyes = GetComponentInChildren<FOV2DEyes>();
        visionCone = GetComponentInChildren<FOV2DVisionCone>();
        currentState = State.IDLE;
        // Disabling auto-braking allows for continuous movement
        // between points (ie, the agent doesn't slow down as it
        // approaches a destination point).
        agent.autoBraking = false;
        agent.Stop ();
        // Set the agent to go to the currently selected destination.
        agent.destination = point.position;

        InvokeRepeating ("CheckVision", 0, 0.3f);
    }
コード例 #14
0
 public override void OnExit()
 {
     agent.Stop();
     agent.SetDestination(owner.transform.position);
 }
コード例 #15
0
ファイル: Stop.cs プロジェクト: NusantaraBeta/BrawlerRumble
		public override void OnEnter ()
		{
			agent = ownerDefault.GetComponent<UnityEngine.NavMeshAgent> ();
			agent.Stop ();
			Finish ();
		}
コード例 #16
0
 public override void OnEnter()
 {
     agent = ownerDefault.GetComponent <UnityEngine.NavMeshAgent> ();
     agent.Stop();
     Finish();
 }