public void ProcessDeath() { WanderingAI behaviour = GetComponent <WanderingAI>(); behaviour.SetAlive(false); StartCoroutine(Die()); }
void Update() { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { Vector3 point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); Ray ray = _camera.ScreenPointToRay(point); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { GameObject hitObject = hit.transform.gameObject; ReactiveTarget target = hitObject.GetComponent <ReactiveTarget>(); WanderingAI ai = hitObject.GetComponent <WanderingAI>(); BackAndForth sphere = hitObject.GetComponent <BackAndForth>(); if (target != null && ai._alive) { target.ReactToHit(); soundSource.PlayOneShot(hitEnemySound); Messenger.Broadcast(GameEvent.ENEMY_HIT); } else { soundSource.PlayOneShot(hitWallSound); StartCoroutine(SphereIndicator(hit.point)); } if (sphere != null) { Destroy(sphere.gameObject); } } } }
internal void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); behavior.Alive = false; StartCoroutine(Die()); }
public void reactToHit() { // added after WanderingAI if (_alive) { audioSource.PlayOneShot(dieSound); WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { behavior.SetAlive(false); } Rigidbody body = GetComponent <Rigidbody> (); if (body != null) { body.freezeRotation = false; } StartCoroutine(Die()); } _alive = false; }
public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); // I want the object to wait on react to hit if (behavior != null) { // Telling the wanderingAI class that the object is waiting... behavior.SetWaiting(true); } StartCoroutine(Wait()); // If I want to kill the object on react to hit... // Telling WanderingAI that this object has died so it can stop it's behavior //if (behavior != null) //{ // behavior.SetAlive(false); //} //StartCoroutine(Die()); }
private IEnumerator Die() { this.transform.Rotate(-75, 0, 0); yield return(new WaitForSeconds(1.5f)); Destroy(this.gameObject); WanderingAI nas = GetComponent <WanderingAI>(); }
void Update() { // enables or disables mouse lock and visibility also pauses game if mouse is visible if (Input.GetKeyDown(KeyCode.Alpha1)) { if (Cursor.visible == true) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; Time.timeScale = 1f; settingsPopUp.Close(); } else { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; Time.timeScale = 0f; settingsPopUp.Open(); } } // enables shooing only if game isnt paused if (Time.timeScale != 0) { if ((Input.GetKeyDown(KeyCode.RightControl)) && (!EventSystem.current.IsPointerOverGameObject())) { // this creates a vector with the coridnates of the rays origin Vector3 point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); muzzleFlash.Play(); gunShot.Play(); // creates ray object with origin cordinates Ray ray = _camera.ScreenPointToRay(point); // pases the ray and a new object with type RaycastHit if (Physics.Raycast(ray, out RaycastHit hit)) { // this retrieves the object the ray hit GameObject hitObject = hit.transform.gameObject; ReactiveTarget target = hitObject.GetComponent <ReactiveTarget>(); GameObject enemy = hit.transform.gameObject; WanderingAI lifeStatus = enemy.GetComponent <WanderingAI>(); // this checks if the target is a person though the get component method and if it is // it returns a hit and if not it creates a sphere in the debug console. // get component returns null if the component isnt there. if ((target != null) && (lifeStatus.getAlive())) { target.ReactToHit(); Messenger.Broadcast(GameEvent.ENEMY_HIT); } else { // starts the coroutine kicking control to it StartCoroutine(SphereIndicator(hit.point)); } } } } }
public void ReactToHit() {//метод, вызванный сценарием стрельбы WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) {//проверяем, есть ли сценарий WanderingAI behavior.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() // իրան կրակելու t կանչվող method․ { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) // սաղ լինի, նոր սպանենք․ եթե սաղ չի, սատկացնել, նոր սպանել․ { behavior.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { behavior.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI behaviour = GetComponent <WanderingAI>(); if (behaviour != null) { behaviour.Kill(); } StartCoroutine(Die()); }
public void ReactToHit() //método para matar o inimigo { WanderingAI behavior = GetComponent <WanderingAI>(); //checa se o objeto tem o script atrelado a ele if (behavior != null) { behavior.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI wanderingai = GetComponent <WanderingAI>(); if (wanderingai != null) { wanderingai.setDie(); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI behaviour = GetComponent <WanderingAI> (); if (behaviour != null) // if it has a WanderingAI script { behaviour.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI ai = GetComponent <WanderingAI>(); if (ai != null) { ai.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() {//метод, вызванный сценарием стрельбы WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { //проверяем, есть ли сценарий WanderingAI behavior.SetAlive(false); //вызываем метод SetAlive и меняем жизнь врага на false } StartCoroutine(Die()); //вызываем сопрограмму смерти врага }
public void ReactToHit() { WanderingAI wanderingAI = GetComponent <WanderingAI>(); if (wanderingAI != null) { wanderingAI.life = WanderingAI.state.DEAD; } StartCoroutine(Die()); }
public void ReactToHit() {//метод, вызванный сценарием стрельбы WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { //проверяем, есть ли сценарий WanderingAI behavior.SetAlive(false); //вызываем функцию SetAlive со значением false } StartCoroutine(Die()); //вызов сопрограммы }
public void reactToHit() { WanderingAI wanderingAI = GetComponent <WanderingAI>(); if (wanderingAI != null) { wanderingAI.setAlive(false); } StartCoroutine(die()); }
// Method called by the shooting script public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { // Set the target state to false to indicate the target's current state is dead behavior.SetAlive(false); } StartCoroutine(Die()); }
//вызывается сценарием стрельбы RayShooter public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); //проверка нужна т.к. он может и отсутствовать if (behavior != null) { behavior.SetAlive(false); } StartCoroutine(Die()); }
void SetInitialReferences() { enemyMaster = GetComponent <EnemyMaster>(); myWanderAI = GetComponent <WanderingAI>(); patrollingAI = GetComponent <PatrollingAI>(); if (GetComponent <NavMeshAgent>() != null) { myNavMeshAgent = GetComponent <NavMeshAgent>(); } checkRate = Random.Range(0.1f, 0.2f); }
public void ReactToHit() { WanderingAI behaviour = this.GetComponent <WanderingAI>(); if (null != behaviour) { behaviour.SetIsAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { //Метод, вызванный сценарием стрельбы. WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) //<-Проверяем, присоединен ли к персонажу сценарий //WanderingAI; он может и отсутствовать { behavior.SetAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { behavior.SetAlive(false); } animator.SetBool("isDead", true); }
public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { //check if this character has a WanderingAI script; it may not behavior.SetAlive(false); } StartCoroutine(Die()); }
// Use this for initialization void Start() { nav = GetComponent <NavMeshAgent> (); rb = GetComponent <Rigidbody> (); anim = GetComponent <Animator> (); sR = GetComponent <SpriteRenderer> (); wAI = GetComponent <WanderingAI> (); eM = GameObject.FindObjectOfType <EncounterManager> (); anim.SetBool("IntroPlaying", true); Physics.IgnoreLayerCollision(11, 8); }
internal void ReactToHit() { WanderingAI behaviur = GetComponent <WanderingAI>(); if (behaviur != null) { behaviur.setAlive(false); } StartCoroutine(Die()); }
public void ReactToHit() { // Get the Wandering AI component script WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { // if shot, turn the alive bool to false to stop movement behavior.SetAlive(false); } StartCoroutine(Die()); // coroutines are similar to interrupts }
public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI> (); if (behavior != null) { behavior.wasKilled(); } // wanderingai? StartCoroutine(Die()); } // hit