// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); target = PlayerManager.instance.player.transform; agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); agent.stoppingDistance = stopDistanceConfig.stoppingDistance; }
void Start() { agent = GetComponent <NavMeshAgent>(); player = GameObject.FindWithTag("Player").transform; manager = GameObject.FindWithTag("manager"); enemyHealth = 20 + Mathf.RoundToInt(manager.GetComponent <gameManager>().roundCount * 1.5f); }
void Start() { agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); agent.SetDestination(Target_Trans.position); agent.isStopped = false; Debug.Log("" + Target_Trans.position); }
private void Awake() { _player = GameObject.FindGameObjectWithTag("Player").transform; _playerHealth = _player.GetComponent <PlayerHealth>(); _enemyHealth = GetComponent <EnemyHealth>(); _nav = GetComponent <NavMeshAgent> (); }
//--------------------------------------------- public void init() { _agent = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); PERTO_MAS_DIALOGO_SER_POSSIVEL = agent.radius * 1.25f; RAIO = _agent.radius;// * transform.localScale.x; layer = LayerMask.NameToLayer("Gajos"); }
void Start() { this.nma = this.GetComponent <UnityEngine.AI.NavMeshAgent>(); this.nma.updatePosition = false; this.p = GameObject.FindWithTag("Player"); this.animator = this.GetComponent <Animator>(); }
// Use this for initialization void Start() { GameObject[] bounds; bounds = GameObject.FindGameObjectsWithTag("fieldBound"); if (bounds [0].transform.position.x < bounds [1].transform.position.x) { _xMin = bounds [0].transform.position.x; _xMax = bounds [1].transform.position.x; _zMin = bounds [0].transform.position.z; _zMax = bounds [1].transform.position.z; } else { _xMin = bounds [1].transform.position.x; _xMax = bounds [0].transform.position.x; _zMin = bounds [1].transform.position.z; _zMax = bounds [0].transform.position.z; } _goalLocations = GameObject.FindGameObjectsWithTag("goal"); _agent = this.GetComponent <UnityEngine.AI.NavMeshAgent>(); _agent.SetDestination(_goalLocations[Random.Range(0, _goalLocations.Length)].transform.position); _anim = this.GetComponent <Animator> (); _speedMult = Random.Range(0.1f, 1.5f); _agent.speed *= _speedMult; if (_anim != null) { _anim.SetFloat("wOffset", Random.Range(0, 1)); _anim.SetTrigger("isWalking"); _anim.SetFloat("speedMult", _speedMult); } }
public virtual void Slide(Vector3 amount, float time = .5f) { if (slideButton) { return; } slideButton = true; if (navMeshAgent == null) { navMeshAgent = gameObject.GetComponent <NavMeshAgent>(); } // off while we slide navMeshAgent.StopAgent(); sliding = true; lastSlideTime = Time.time; lastSlideStartHeight = transform.position.y; lastSlideButtonTime = -10; CancelInvoke("SlideStop"); Invoke("SlideStop", time); }
void Start() { agent = GetComponent <NavMeshAgent>(); agent.SetDestination(finalDestination.position); agent.speed = 3; ChangeSpeed(); }
///////////////////////////////////////////////////////// ////////////////// INITIALIZATION ///////////////////// ///////////////////////////////////////////////////////// void Start() { // Register the unit's components anim = transform.GetChild(0).gameObject.GetComponent <Animator>(); if (anim == null) { anim = GetComponent <Animator>(); } agent = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); source = GetComponent <AudioSource>(); unitCollider = GetComponent <Collider>(); // Initialize things health = startingHealth; agent.updateRotation = true; enemySearchLayer = LayerMask.GetMask("Allies"); allyLayers = LayerMask.GetMask("Allies"); enemyLayers = LayerMask.GetMask("Enemies"); if (isAlly) { enemySearchLayer = enemyLayers; } else { enemySearchLayer = allyLayers; } }
void Start() { candidate = new List <GameObject>(); agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); gos = (GameObject[])FindObjectsOfType(typeof(GameObject)); textToSpeech = GetComponent <TextToSpeech>(); //gos = GameObject.FindGameObjectsWithTag("objects"); navMeshPath = new NavMeshPath(); cur_position = Camera.main.transform.position; last_position = Camera.main.transform.position; //VPACAM = GameObject.Find("VPACAM"); //for (int i = 0; i < gos.Length; i++) //{ // Debug.Log(gos[i].name); //} /* * dictation.DictationResult += (text, medium) => * { * isDoingCov = true; * myListner(myInput); * }; * * myInput.onEndEdit.AddListener(delegate { * isDoingCov = true; * myListner(myInput); * });*/ }
private IEnumerator SetAgentColliderSize() { yield return(new UE.WaitForFixedUpdate()); var localBounds = skinMeshRenderer.localBounds; var bounds = skinMeshRenderer.bounds; var radius = UE.Mathf.Min(bounds.extents.x, bounds.extents.z); capsuleCollider.radius = radius; capsuleCollider.height = bounds.size.y; var center = capsuleCollider.center; center.y = bounds.extents.y; capsuleCollider.center = center; navMeshAgent = gameObject.GetComponent <UEAI.NavMeshAgent>(); if (navMeshAgent == null) { navMeshAgent = gameObject.AddComponent <UEAI.NavMeshAgent>(); } const float agentMarginRatio = 1.5f; navMeshAgent.radius = radius * agentMarginRatio; navMeshAgent.height = capsuleCollider.height; navMeshAgent.obstacleAvoidanceType = UEAI.ObstacleAvoidanceType.MedQualityObstacleAvoidance; navMeshAgent.avoidancePriority = AvoidancePriorityNumber++; navMeshAgent.autoBraking = true; navMeshAgent.autoRepath = true; navMeshAgent.autoTraverseOffMeshLink = false; yield return(null); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <NavMeshAgent> (); }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); vivo = true; agent = GetComponent <NavMeshAgent>(); playerTransform = player.transform; }
void Awake() { if (navMeshAgent == null) { navMeshAgent = GetComponent <NavMeshAgent>(); } }
// Use this for initialization void Start() { agent = this.GetComponent <UnityEngine.AI.NavMeshAgent>(); anim = GetComponent <Animator>(); anim.SetBool("isWalking", true); PickGoalLocation(); }
// Start is called before the first frame update void Start() { agent = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); inPursuit = false; OrganismStart(); Wander(); }
public virtual void Jump(float duration) { if (jumpButton) { return; } jumpButton = true; if (navMeshAgent == null) { navMeshAgent = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); } // off while we jump navMeshAgent.StopAgent(); jumping = true; jumpingReachedApex = false; lastJumpTime = Time.time; lastJumpStartHeight = transform.position.y; touchWallJumpTime = -1; lastJumpButtonTime = -10; CancelInvoke("JumpStop"); Invoke("JumpStop", duration); }
void Start() { _navMeshAgent = this.GetComponent <UnityEngine.AI.NavMeshAgent>(); if (_navMeshAgent == null) { Debug.LogError("Nav mesh not attached to" + gameObject.name); } else { GameObject [] collectibles = GameObject.FindGameObjectsWithTag("CollectiblesTag"); GameObject [] boatPosition = GameObject.FindGameObjectsWithTag("BoatTag"); targets = new Transform[collectibles.Length + 1]; for (int x = 0; x < collectibles.Length; x++) { targets[x] = collectibles[x].transform; } targets[collectibles.Length] = boatPosition[0].transform; if (collectibles.Length < 1) { Debug.Log("None available positions"); } else { _navMeshAgent.destination = targets[i].position; } } }
void Update() { // Nav Mesh Stuff Move = GetComponent <UnityEngine.AI.NavMeshAgent>(); Move.SetDestination(Player.transform.position); // Make Sure The Enemy Is Facing The Player transform.LookAt(Player); // Registering Player Score Total = ScoreCounter1.Coop + ScoreCounter2.Coop + ScoreCounter3.Coop + ScoreCounter4.Coop + ScoreCounter5.Coop; // Movement Speed Increasing Based On Player Score if (Total > 799) { Move.speed = .3f; } if (Total > 1399) { Move.speed = .6f; } if (Total > 1999) { Move.speed = 1.1f; } }
void Start() { anim = GetComponent <Animator> (); agent = GetComponent <UnityEngine.AI.NavMeshAgent> (); // Don’t update position automatically agent.updatePosition = false; }
//public GameObject shot; //public Transform shotTransform; // Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); agent.destination = waypoint.transform.position; sightCollider = GetComponent <SphereCollider>(); stateMachine.ChangeState(new State_Patrol(this)); }
private void Start() { EventManager.instance.events[EVENT_TYPES.COMBAT_START].AddListener(StartCombat); currentAIMode = AIMode.Passive; audioSource = GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); agent = this.GetComponent <UnityEngine.AI.NavMeshAgent>(); animator = this.transform.GetChild(0).GetComponent <Animator>(); coverPointManger = FindObjectOfType <CoverPointManager>(); collider = this.transform.GetChild(0).GetComponent <CapsuleCollider>(); animator.SetBool("IsShooting", false); dead = false; initialColliderHeight = collider.height; AllyControl[] targets = FindObjectsOfType <AllyControl>(); foreach (AllyControl ac in targets) { if (ac.Alive) { targetsTransform.Add(ac.transform); } } targetsTransform.Add(player); }
// Use this for initialization void Start() { initialPos = transform.position; initialDir = transform.rotation; Players = GameObject.FindGameObjectsWithTag("Player"); int i = 0; while (i < Players.Length && !Players[i].activeSelf) { i++; } Player = Players[i].transform; isFocused = false; audio = Players[0].GetComponent <AudioSource>(); nav = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); fireuse = 0f; }
//------------------------------------ // Methods //------------------------------------ private void Start() { TargetAimDecal.gameObject.SetActive(false); agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); lineRenderer = GetComponent <LineRenderer>(); }
public void backAI2() { if (tairyoku <= 0) { if (!soundcheck) { audioSource.PlayOneShot(KillSounds); soundcheck = true; tairyoku2.ScoreCount(); } audioSource.PlayOneShot(KillSounds); AIDown.DeathAnim(); // Debug.Log(transform.name + tairyoku +"backAI"); RigthtArm.localRotation = Quaternion.Euler(80, -50, RigthtArm.localRotation.z); LeftArm.localRotation = Quaternion.Euler(-50, 50, LeftArm.localRotation.z); RArmUPER2.localRotation = Quaternion.Euler(0, RArmUPER2.localRotation.y, 0); UnityEngine.AI.NavMeshAgent agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); Debug.Log("AINav"); agent.destination = StartPoint.position;//startPoint Restart if (deathNo == 0) { this.GetComponent <TacticalAI.TargetScript>().ChangeTeamID(); this.GetComponent <TacticalAI.TargetScript>().RemoveMine(); deathNo += 1; } } }
// Use this for initialization void Awake() { attackType = (int)specialAttackType; chase = new NodeChase(this); attack = new NodeAttack(this); stunned = new NodeStunned(this); melee = new NodeAttackMelee(this); if (attackType == (int)SpecialAttackType.Lunge) { special = new NodeSpecialAttackLunge(this); } if (attackType == (int)SpecialAttackType.Ranged) { special = new NodeSpecialAttackRanged(this); } if (attackType == (int)SpecialAttackType.DoubleShot) { special = new NodeSpecialAttackRangedDouble(this); } npcNav = GetComponent <NPCNavigation>(); if (npcNav == null) { npcNav = transform.parent.GetComponent <NPCNavigation>(); } navMeshAgent = GetComponent <NavMeshAgent>(); if (navMeshAgent == null) { navMeshAgent = transform.parent.GetComponent <NavMeshAgent>(); } targets = new Transform[2]; }
//private Vector3 previousSighting; void Awake() { nav = GetComponent <NavMeshAgent>(); player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth>(); anim = GetComponent <Animator>(); }
public void checkAnimation() { if (Vector3.Distance(player.position, this.transform.position) < distance) { Vector3 direction = player.position - this.transform.position; direction.y = 0; this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(direction), 0.1f); anim.SetInteger("moving", 0); nav = GetComponent <NavMeshAgent>(); nav.isStopped = true; if (direction.magnitude < 15) { nav = GetComponent <NavMeshAgent>(); nav.isStopped = false; anim.SetBool("attack", false); anim.SetBool("trick", true); anim.SetInteger("moving", 1); nav.SetDestination(player.position); } if (direction.magnitude < 5) { nav = GetComponent <NavMeshAgent>(); nav.isStopped = true; anim.SetInteger("moving", 0); anim.SetBool("attack", true); } } }
void Start() { //get the navmesh agent = GetComponent <NavMeshAgent> (); //set a first random timer for random wandering timer = Random.Range(wanderTimerMin, wanderTimerMax); }
public Node_MoveTo_With_Avoid(UnityEngine.AI.NavMeshAgent agent) { m_agent = agent; }
// Use this for initialization void Start() { agent = gameObject.GetComponent<UnityEngine.AI.NavMeshAgent> (); }
//temp----------------------------- public Node_MoveTo_With_Avoid(UnityEngine.AI.NavMeshAgent agent, Vector3 loc) { m_agent = agent; SetDestination(loc); }
void Start() { player = GameObject.FindGameObjectWithTag (Tags.player); agent = player.GetComponent<UnityEngine.AI.NavMeshAgent>(); gba = player.GetComponent<BasicGBA>(); sbgba = player.GetComponent<StateBasedGBA>(); mbgba = player.GetComponent<MemoryBasedGBA>(); ebgba = player.GetComponent<ExplorationBasedGBA>(); uba = player.GetComponent<UBA>(); }
public Node_Align(UnityEngine.AI.NavMeshAgent agent) { m_agent = agent; SetDirection(m_agent.destination); }
public override void Initialize(BaseDynamicModel model) { base.Initialize(model); navMeshAgent = model.GetView().GetGameObject().GetComponent<NavMeshAgent>(); }