private void Start() { alertBar = GetComponentInChildren <EnemyAlertBar>(); alertBar.DisableAlertBar(); pathing = GetComponent <EnemyPathing>(); vision = GetComponentInChildren <EnemyVision>(); }
// Start is called before the first frame update void Start() { ciclePartSysRend.enabled = false; transform.position = new Vector2(-4.45f, 8.91f); meteorSpawner = FindObjectOfType <MeteorSpawnerScript>().gameObject; meteorSpawnerScript = meteorSpawner.GetComponent <MeteorSpawnerScript>(); meteorSpawnerScript.MakeSpawnRateFaster(); isDying = false; mySpriteRenderer = GetComponent <SpriteRenderer>(); eyeChildSpriteRenderer = eyechild.GetComponent <SpriteRenderer>(); enemyScript = GetComponent <Enemy>(); thePlayer = FindObjectOfType <Player>().gameObject; playerscript = thePlayer.GetComponent <Player>(); bossPeanutMakerAudiosource = GetComponent <AudioSource>(); myPathing = gameObject.GetComponent <EnemyPathing>(); launchLaser = false; //cache var chikenNuggets = new List <PeanutScript>(); for (int i = 0; i < icePeanut.Count; i++) { chikenNuggets.Add(icePeanut[i].GetComponent <PeanutScript>()); } icePeanutScript = chikenNuggets; mySpriteRenderer.enabled = false; StartCoroutine(DelayEnableSpriteRenderer()); }
public virtual void SetAffected(Enemy enemy, float strength, float duration) { freezeStrength = strength; durationInSeconds = duration; enemyAffected = enemy; enemyPathing = enemy.GetEnemyPathing(); shouldFX = true; }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); path = GetComponent <EnemyPathing>(); IsActive = true; startHealth = health; initialSpeed = path.Speed; SlowTime = 0; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Enemy") { EnemyPathing enemyPathing = collision.GetComponent <EnemyPathing>(); Destroy(gameObject); Destroy(enemyPathing.gameObject); } }
protected void Start() { SetRandomShootCounter(); _player = GameObject.FindGameObjectsWithTag("Player").Where(_ => _.name == "Player").FirstOrDefault(); _sm = GetComponent <EnemyFSM> (); _pathing = GetComponent <EnemyPathing> (); _flasher = GetComponent <Flasher> (); Max_Health = Health; }
private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { for (int i = 0; i < waveConfig.NumberOfEnemies; i++) { GameObject enemy = Instantiate(waveConfig.EnemyPrefab, waveConfig.GetWaypoints().First().position, Quaternion.identity); EnemyPathing pathing = enemy.GetComponent <EnemyPathing>(); pathing.SetWaveConfig(waveConfig); yield return(new WaitForSeconds(waveConfig.TimeBetweenSpawns)); } }
private void SpawnEnemy(WaveConfiguration waveConfiguration) { List <Transform> waypoints = waveConfiguration.GetWaypoints(); GameObject enemy = Instantiate(waveConfiguration.GetEnemyPrefab(), waypoints[1].position, Quaternion.identity); EnemyPathing enemyController = enemy.GetComponent <EnemyPathing>(); enemyController.SetWaypoints(waypoints); enemyController.SetMovementSpeed(waveConfiguration.GetMovementSpeed()); }
private static void SpawnEnemy(EnemyWaveConfig enemyWaveConfig, EnemyPathing enemyPathing) { var enemy = Instantiate( enemyWaveConfig.EnemyPrefab, enemyWaveConfig.GetWaypoints()[0].position, Quaternion.identity); var enemyComp = enemy.GetComponent <Enemy>(); SetEnemyAttributes(enemyWaveConfig, enemyComp); enemyPathing.AddEnemy(enemy); }
private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { // Itera numero de inimigos for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++) { // Instancia novo inimigo var newEnemy = Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity); EnemyPathing enemyPathing = newEnemy.GetComponent <EnemyPathing>(); enemyPathing.SetWaveConfig(waveConfig); yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns())); } }
private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++) { var enemy = Instantiate( waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity); EnemyPathing enemyPathing = enemy.GetComponent <EnemyPathing>(); enemyPathing.SetWaypoints(waveConfig.GetWaypoints()); enemyPathing.SetMoveSpeed(waveConfig.GetMoveSpeed()); spawnedEnemiesCounter++; yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns())); } }
private IEnumerator Attack(int combo) { var time = 0f; Vector3 pos; RaycastHit[] raycastHits; _isAttacking = true; _animator.SetBool("attack", true); yield return(null); while (time < _swirlTime) { time += Time.deltaTime; pos = transform.position; raycastHits = Physics.SphereCastAll(transform.position, _attackRange, Vector3.forward, 0.1f, 1 << LayerMask.NameToLayer("Enemy")); foreach (var hit in raycastHits) { if (_enemiesHit.Contains(hit.transform.gameObject.GetInstanceID())) { break; } Vector3 vec = hit.transform.position; Vector3 direction = vec - _meshObject.transform.position; if (Vector3.Dot(direction, _meshObject.transform.right) > 0.7 || Vector3.Dot(direction, -_meshObject.transform.right) > 0.7) { _events.onAttack(); EnemyPathing enemy = hit.transform.gameObject.GetComponent <EnemyPathing>(); if (enemy != null) { _enemiesHit.Add(hit.transform.gameObject.GetInstanceID()); enemy.DamagedByPlayer(); } } } yield return(null); } _enemiesHit.Clear(); _animator.SetBool("attack", false); _isAttacking = false; }
private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++) { GameObject enemyTemp = Instantiate( waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoint()[0].transform.position, Quaternion.identity); EnemyPathing enemyPathing = enemyTemp.GetComponent <EnemyPathing>(); enemyPathing.SetWaveConfig(waveConfig); // Cutre as f**k // Tiempo entre oleadas. yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawn())); } }
private void Awake() { anim = GetComponentInChildren <Animator>(); colliders = GetComponentsInChildren <Collider>(); pathing = GetComponent <EnemyPathing>(); randomizer = GetComponent <MaterialRandomizerBase>(); scrapPrefab = Instantiate(scrapPrefab, MobileUiManager.um_single.scrapCanvas.transform); scrap = scrapPrefab.GetComponent <MobileUiScrap>(); scrap.Init(Movement.m_Single.topdownCamera.transform); if (CheckForSpawner()) { GameObject health = Instantiate(spawner.GetMobileUiHealtPrefab(), transform.position, Quaternion.identity); mobileUiHealth = health.GetComponent <MobileUiHealth>(); mobileUiHealth.SetTarget(this); mobileUiHealth.transform.SetParent(MobileUiManager.um_single.mobileUiCanvas.transform); mobileUiHealth.gameObject.SetActive(false); } gameObject.SetActive(false); }
private void ProcessHit(DamageDealer damageDealer) { if (bossBrainy) { health -= (damageDealer.GetDamage() * 2); } else { if (invincibilityOn) { //Nodamage } else { health -= damageDealer.GetDamage(); } } //damageDealer.Hit(); if (health <= 0) { if (gameObject.tag == "Enemy") { Die(); } else if (bossPeanutMaker) { bossPeanutScript.Start_BossPeanut_Death_Sequence(); mypathing = GetComponent <EnemyPathing>(); mypathing.Activate_Boss_Death_path(); } else { FindObjectOfType <ParentEnemy>().OnHitDestroyParent(); Die(); } } }
private void Fire() { pokemon = GetComponent <EnemyPathing>(); if (pokemon.GetPokemonValue() == 1) { GameObject laser = Instantiate(firePrefab, new Vector3(transform.position.x, transform.position.y - 0.3f, transform.position.z), Quaternion.identity) as GameObject; laser.GetComponent <Rigidbody2D>().velocity = new Vector2(0, projectileSpeed); } if (pokemon.GetPokemonValue() == 2) { GameObject laser = Instantiate(waterPrefab, new Vector3(transform.position.x, transform.position.y - 0.3f, transform.position.z), Quaternion.identity) as GameObject; laser.GetComponent <Rigidbody2D>().velocity = new Vector2(0, projectileSpeed); } if (pokemon.GetPokemonValue() == 3) { GameObject laser = Instantiate(grassPrefab, new Vector3(transform.position.x, transform.position.y - 0.3f, transform.position.z), Quaternion.identity) as GameObject; laser.GetComponent <Rigidbody2D>().velocity = new Vector2(0, projectileSpeed); } if (pokemon.GetPokemonValue() == 4) { GameObject laser = Instantiate(psychicPrefab, new Vector3(transform.position.x, transform.position.y - 0.3f, transform.position.z), Quaternion.identity) as GameObject; laser.GetComponent <Rigidbody2D>().velocity = new Vector2(0, projectileSpeed); } }
void Start() { enemy = GetComponent<EnemyPathing>(); enemySightSeal = GetComponent<EnemySight>(); EquipGun(0); }
// Use this for initialization void Start() { enemy = GetComponentInParent<EnemyPathing>(); plyr = GameObject.FindGameObjectWithTag("Player"); Debug.Log(enemy); }
public void doPathFinding() { Node firstNode = new Node(m_current, null, m_end, m_start); finalPath = new EnemyPathing(); OpenList openedList = new OpenList(); openedList.insertToOpenList(firstNode); ClosedList closedList = new ClosedList(); SearchLvl search_lvl = new SearchLvl(); while (openedList.isEmpty() == false) { Node secondNodes = openedList.get0(); Node secondNode = new Node(secondNodes.getPosition(), secondNodes.returnPrev(), m_end, m_start); openedList.remove0Fromlist(); closedList.insertToClosedList(secondNode); if (Physics2D.OverlapBox(new Vector2(secondNode.getPosition().x, secondNode.getPosition().y), new Vector2(m_halfWidth / 2, m_halfWidth / 2), 0, targetMask)) { results = secondNode; break; } List <Node.Position> adjacentPositions = search_lvl.getAdjacentNodes(secondNode.getPosition().x, secondNode.getPosition().y, tileWid); for (int i = 0; i < adjacentPositions.Count; i++) { if (closedList.isInClosedList(adjacentPositions[i])) { continue; } int inter = openedList.findFromOpenList(secondNode.getPosition()); //returns -1 if there was no match, iterator cant be negative anyway Node previousNode = new Node(adjacentPositions[i], secondNode, m_end, m_start); if (inter != -1) { //has been found in open list if (openedList.returnAt(inter).getDistanceFromStart() > previousNode.getDistanceFromStart()) //the new distance is smaller { openedList.returnAt(inter).setPrev(secondNode); //setting the previous node that is found at the index } } else { //lineDrawer(previousNode.getPosition().x, previousNode.getPosition().y); //This method just creates a box, used for debugging purposes only! openedList.insertToOpenList(previousNode); } } } if (results != null) { while (results != null) { if (results.returnPrev() == null) { finalPath.insertToPath(results); results = null; donePathFind = true; } else { //Debug.DrawLine(new Vector2(results.getPosition().x, results.getPosition().y), new Vector2(results.returnPrev().getPosition().x, results.returnPrev().getPosition().y), Color.red, 1, false); finalPath.insertToPath(results); //draw a line to prev results = results.returnPrev(); } } finalPath.Reversed(); } else { donePathFind = true; finalPath = null; //NOT FOUND } }
// Use this for initialization void Start() { enemy = GetComponentInParent <EnemyPathing>(); plyr = GameObject.FindGameObjectWithTag("Player"); Debug.Log(enemy); }
private void RandomPathing() { currentPathing = pathing[Random.Range(0, pathing.Length - 1)]; }
void Start() { enemy = GetComponent <EnemyPathing>(); enemySightSeal = GetComponent <EnemySight>(); EquipGun(0); }
void Start() { pathing = gameObject.GetComponentInParent <EnemyPathing>(); Player = FindObjectOfType <PlayerController>(); }
private IEnumerator SpawnAllEnemiesInEnemyWave(EnemyWaveConfig enemyWaveConfig, EnemyPathing enemyPathing, LevelWaveConfig currentLevelWave, bool last) { yield return(new WaitForSeconds(enemyWaveConfig.SpawnDelay)); do { for (var i = 0; i < enemyWaveConfig.NumberOfEnemies; i++) { SpawnEnemy(enemyWaveConfig, enemyPathing); yield return(new WaitForSeconds(Random.Range(enemyWaveConfig.MinTimeBetweenSpawns, enemyWaveConfig.MaxTimeBetweenSpawns))); } } while (enemyWaveConfig.ContinuousSpawning && (currentLevelWave.WaveSpawning || FindObjectsOfType <Enemy>().Length > 0)); if (last) { currentLevelWave.WaveSpawning = false; } }
void Update() { enemyposition = transform.parent.position - new Vector3(0, 0.9f, 0); //get feet position for pathing transform.parent.GetChild(1).position = transform.GetChild(0).GetChild(0).position; //place gun on hand transform.parent.GetChild(1).eulerAngles = transform.GetChild(0).eulerAngles; //rotate gun if (!anim.IsPlaying("EnemyCrouch") && !anim.IsPlaying("EnemyDead")) { anim.Stop(); } if (!gun.IsPlaying("GunFire")) { gun.Stop(); } //health if (Health <= 0) { if (behaviour != -1) { anim.Play("EnemyDead"); behaviour = -1; nodetype = -1; node = -1; agent.destination = transform.position; transform.parent.forward = transform.GetChild(0).forward; Destroy(transform.GetComponent <Rigidbody>()); Destroy(transform.GetComponent <CapsuleCollider>()); } return; } /* * behaviour = -1 -> dead * behaviour = 0 -> patrol (default) * behaviour = 1 -> look for last seen * behaviour = 2 -> patrol open areas * bahaviour = 3 -> alarmed, conditions can vary * behaviour = 4 -> standard combat * behaviour = 5 -> increased aggression while winning * behaviour = 6 -> increased defensive while losing * behaviour = 7 -> massive increase aggression while losing * behaviour = 8 -> massive increase defensive while losing * behaviour = 9 -> waiting - looking around while standing */ //check player sighting playerseen = false; if (EnemyPathing.LookForPlayer(transform, player, Fov, ViewRange, VCloseRange, CloseRange) == true) { playerseen = true; lastseenposition = player.position; lastseentype = 1; } //gunfire if (playerseen == true) { if (shootcurr > 1f) { shootcurr = 0f; //transform.parent.forward = transform.GetChild(0).forward; //gun.Play("GunFire"); AudioSource.PlayClipAtPoint(fire, transform.GetChild(0).GetChild(0).position); RaycastHit shot; if (Physics.Raycast(transform.GetChild(1).position, transform.GetChild(0).forward, out shot)) { if (shot.transform == player) { AudioSource.PlayClipAtPoint(playerhurt, player.position); Fear -= 5; string a = PlayerHealth.text.Substring(7); PlayerHealth.text = PlayerHealth.text.Substring(0, 8) + (int.Parse(PlayerHealth.text.Substring(7)) - 5).ToString(); } } } else { shootcurr += Time.deltaTime; } } //update lastseen if (((behaviour > 3) || (behaviour == 1)) && (behaviour != 9)) { while (lastseentype < 3) { if (EnemyPathing.PredictPlayer(player, lastseenposition, lastseentype) == true) { playerseen = true; break; } else { lastseenposition = player.position; lastseentype++; } } } //check nearby enemies for (int i = 0; i < enemies.childCount; i++) { if (!ignoreai.Contains(i)) //dont check itself or already seen dead { Vector3 dir = enemies.GetChild(i).position - transform.position; //nearby parameters if (((Vector3.Distance(transform.position, enemies.GetChild(i).position) < ViewRange) && (Vector3.Angle(transform.forward, dir) < Fov)) || (Vector3.Distance(transform.position, enemies.GetChild(i).position) < CloseRange)) { RaycastHit hit; if (Physics.Linecast(transform.position, enemies.GetChild(i).position, out hit, (1 << 0) | (1 << 12))) { if (hit.collider.name == "Body") { Debug.DrawLine(transform.position, enemies.GetChild(i).position, Color.magenta, 0.1f); //get nearby ai variables int nbehaviour = hit.transform.GetComponent <EnemyMechanics>().behaviour; int nnodetype = hit.transform.GetComponent <EnemyMechanics>().nodetype; int nnode = hit.transform.GetComponent <EnemyMechanics>().node; float ncurrtime = hit.transform.GetComponent <EnemyMechanics>().currtime; float nwaittime = hit.transform.GetComponent <EnemyMechanics>().waittime; bool ncover = hit.transform.GetComponent <EnemyMechanics>().cover; bool ncoverout = hit.transform.GetComponent <EnemyMechanics>().coverout; bool nignorenearbycover = hit.transform.GetComponent <EnemyMechanics>().ignorenearbycover; Vector3 nlastseenposition = hit.transform.GetComponent <EnemyMechanics>().lastseenposition; Vector3 nmovetoposition = hit.transform.GetComponent <EnemyMechanics>().movetoposition; //fix wait behaviour int tempb = behaviour; if (behaviour == 9) { tempb = prevb; } if (nbehaviour == 9) { nbehaviour = hit.transform.GetComponent <EnemyMechanics>().prevb; } if ((tempb == 0) && (nbehaviour != 0)) //check if nearby alarmed or dead when patrolling { if (nbehaviour == -1) { lastseenposition = hit.transform.position; behaviour = 2; ignoreai.Add(i); Wait(15, 180); } else if (tempb > 3) { behaviour = 3; movetoposition = nlastseenposition; } else { behaviour = 3; movetoposition = nmovetoposition; } } else if (nbehaviour == -1) //if nearby dead while alarmed, add to ignore list { ignoreai.Add(i); } else if ((tempb < 3) && (nbehaviour > 2)) //check if nearby alarmed knows player position { behaviour = 3; movetoposition = nlastseenposition; } else if ((nnodetype == nodetype) && (nnode == node) && (node != -1)) //dont move to same node { Vector3 dest = EnemyPathing.GetNodePosition(nodetype, node); if (EnemyPathing.Distance(hit.transform.position, dest) < EnemyPathing.Distance(transform.position, dest)) { blacklistnode.Add(node); node = -1; nodetype = -1; } } else if ((ignorenearbycover == false) && (nignorenearbycover == false) && (cover == true) && (ncover == true)) //in and out of cover same time { if ((coverout == true) && (ncoverout == false)) { currtime = waittime; } else if (waittime > nwaittime) { waittime = nwaittime; currtime = ncurrtime; } } //update fear Fear = EnemyPathing.UpdateFear(i, teamhp[i], hit.transform.GetComponent <EnemyMechanics>().Health, Fear); teamhp[i] = hit.transform.GetComponent <EnemyMechanics>().Health; } } } } } if ((playerseen == true) && (behaviour == 4)) { if (Fear >= 30) { if (Random.Range(1, 4) == 1) { behaviour = 7; } else { behaviour = 8; } } else if (Fear >= 15) { behaviour = 6; } else if (Fear <= -20) { behaviour = 5; } } //behaviours if (behaviour == 0) { agent.stoppingDistance = 2f; if (blacklistnode.Count == EnemyPathing.PNode.Count) { blacklistnode.Clear(); } if (playerseen == true) { behaviour = 4; } else if (node == -1) { nodetype = 0; node = EnemyPathing.StandardPathing(blacklistnode); movetoposition = EnemyPathing.PNode[node]; } else if (Vector3.Distance(enemyposition, movetoposition) < agent.stoppingDistance) { blacklistnode.Clear(); node = EnemyPathing.StandardPathing(blacklistnode); movetoposition = EnemyPathing.PNode[node]; Wait(45, 120); } } else if (behaviour == 1) { nodetype = -1; node = -1; agent.stoppingDistance = 4f; movetoposition = lastseenposition; if (playerseen == true) { behaviour = 4; } else if (Vector3.Distance(enemyposition, movetoposition) < agent.stoppingDistance) { behaviour = 2; Wait(5, 180); } } else if (behaviour == 2) { nodetype = -1; agent.stoppingDistance = 6f; if (playerseen == true) { behaviour = 4; } else if (Vector3.Distance(enemyposition, movetoposition) < agent.stoppingDistance) { if (searchcount < 4) { if (searchcount == 1) { points = EnemyPathing.SearchPlayerPathing(lastseenposition); } movetoposition = EnemyPathing.INode[points[searchcount - 1]]; Wait(8, 360); searchcount++; } else { behaviour = 0; node = -1; nodetype = 0; Wait(8, 120); } } } else if (behaviour == 3) { node = -1; nodetype = -1; agent.stoppingDistance = 6f; if (playerseen == true) { behaviour = 4; } else if (Vector3.Distance(enemyposition, movetoposition) < agent.stoppingDistance) { Wait(10, 120); behaviour = 2; } } else if (behaviour == 4) { agent.stoppingDistance = 0.5f; Cover(); } else if (behaviour == 5) { agent.stoppingDistance = 0.5f; ignorenearbycover = true; Cover(); } else if (behaviour == 6) { agent.stoppingDistance = 0.5f; ignorenearbycover = true; Cover(); } else if (behaviour == 7) { agent.stoppingDistance = 5f; node = -1; nodetype = -1; movetoposition = lastseenposition; if (playerseen == false) { behaviour = 2; } } else if (behaviour == 8) { agent.stoppingDistance = 0.5f; node = -1; nodetype = -1; movetoposition = (lastseenposition - enemyposition) * -3f; if (playerseen == false) { behaviour = 1; } } else if (behaviour == 9) { if (playerseen == true) { behaviour = 4; currtime = 0; } else if (currtime < waittime) { dir = EnemyPathing.Waiting(transform, TurnAngle, TurnSpeed * 5, dir, odir); forward = true; currtime += Time.deltaTime; } else { behaviour = prevb; currtime = 0; } } if ((behaviour < 4) || (behaviour > 6)) { cover = false; } if (behaviour != 9) { EnemyPathing.LookPosition(transform, behaviour, lastseenposition, movetoposition, agent, cover, coverout, node, nodetype, out lookatposition, out forward); EnemyPathing.RotateEnemy(transform, lookatposition, TurnSpeed, forward); agent.SetDestination(movetoposition); } }
void Cover() { if (nodetype == -1) { EnemyPathing.TakeCover(player, transform, lastseenposition, blacklistnode, ViewRange, out nodetype, out node); } if (Vector3.Distance(enemyposition, movetoposition) < agent.stoppingDistance) { if ((waittime == -1) && (nodetype == 1)) { Crouching(true); } if (currtime == 0) { float scale = 1f; if (behaviour == 4) { scale = 1f; } else if (behaviour == 5) { if (coverout == true) { scale = 2f; } else { scale = 0.5f; } } else if (behaviour == 6) { if (coverout == true) { scale = 0.5f; } else { scale = 2f; } } waittime = Random.Range(4, 8) * scale; } cover = true; blacklistnode.Clear(); } if (cover == true) { if (playerseen == true) { if (EnemyPathing.CoverOK(player, node, nodetype) == false) { if (nodetype == 1) { Crouching(false); } EnemyPathing.TakeCover(player, transform, lastseenposition, blacklistnode, ViewRange, out nodetype, out node); if (nodetype == 1) { movetoposition = EnemyPathing.CNode[node]; } else if (nodetype == 2) { movetoposition = EnemyPathing.WNode[node]; } else { agent.stoppingDistance = 5f; movetoposition = lastseenposition; } waittime = -1f; currtime = 0f; cover = false; coverplayerseen = false; coverout = false; } else { coverplayerseen = true; } } if (currtime < waittime) { currtime += Time.deltaTime; } else if (waittime != -1) { currtime = 0; if (coverout == true) { if (coverplayerseen == false) { if (nodetype == 1) { Crouching(false); } node = -1; nodetype = -1; if (behaviour == 4) { behaviour = 1; Wait(5, 60); } else if (behaviour == 5) { behaviour = 1; } else if (behaviour == 6) { behaviour = 1; Wait(10, 60); } } else { coverout = false; if (nodetype == 1) { Crouching(true); } else { movetoposition = EnemyPathing.WallNode.GetChild(node).position; } } } else { if (behaviour == 4) { ignorenearbycover = false; } coverplayerseen = false; coverout = true; if (nodetype == 1) { Crouching(false); } else { movetoposition = EnemyPathing.WallNode.GetChild(node).GetChild(1).position; } } } } else { if (updatetime < 0.3f) { updatetime += Time.deltaTime; } else { updatetime = 0f; EnemyPathing.TakeCover(player, transform, lastseenposition, blacklistnode, ViewRange, out nodetype, out node); if (nodetype == 1) { movetoposition = EnemyPathing.CNode[node]; } else if (nodetype == 2) { movetoposition = EnemyPathing.WNode[node]; } else { agent.stoppingDistance = 5f; movetoposition = lastseenposition; } } } }