public void TakeDamage(float amount) { health -= amount; //if shot by player and has not noticed, make enemy angry and always chase player if (!hasNoticed) { attackRadius = Vector3.Distance(target.position, transform.position) * 1.15f; Debug.Log("Shot me in the back? Now I'm angry! Attack radius == " + attackRadius); //moveCloserRadius = attackRadius + 20f; //hasNoticed = true; } if (health <= 0f && !isDead)//if health is below zero and is not already dead { Debug.Log("I, " + gameObject.name + " am dead! Distributing bounty..."); isDead = true; //target.IncreaseScore(10); //call level controller to increase score Level01Controller _lc1 = FindObjectOfType <Level01Controller>(); _lc1.IncreaseScore(bounty); if (gameObject.name == "Enemy_BOOS") { _lc1.KillBoss(); } //start death procedure StartCoroutine(Die()); } }
private void OnTriggerEnter(Collider other) { Level01Controller level01Controller = new Level01Controller(); PlayerMovement playerMovement = other.gameObject.GetComponent <PlayerMovement>(); if (playerMovement != null) { level01Controller.TakeDamage(1); } }
private void Die() { Impact.PlayOneShot(DeathSound); deathMenuUI.SetActive(true); reticle.SetActive(false); Level01Controller.SetCurrentTime(0f); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; playerIsDead = true; }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { PowerUpSound.Play(); Level01Controller.SetCurrentTime(0.5f); Player.SetAlteredSpeed(speed * 2); // StartCoroutine("Destroy"); } }
public void TakeDamage(float amount) { health -= amount; if (health <= 0f) { //Die(); StartCoroutine(Die()); Level01Controller _lc1 = FindObjectOfType <Level01Controller>(); _lc1.IncreaseScore(destructionReward); } //explosionGO = Instantiate(explosionEffect, transform.position, transform.rotation); //Destroy(explosionGO, 15f); }
private void Awake() { IceCube.SetActive(false); EnableObject(); ogScale = IceCube.transform.localScale; ogPosition = IceCube.transform.position; rb = Player.GetComponent <Rigidbody>(); PLC_translater = GameObject.Find("FPSCharacter"); PLC = PLC_translater.GetComponent <PlayerController>(); LV_Translater = GameObject.Find("LevelController"); LV = LV_Translater.GetComponent <Level01Controller>(); HitCircle_Translater = GameObject.Find("HitCircle"); HitCircle = HitCircle_Translater.GetComponent <Text>(); SpottedSymbol.SetActive(false); }
IEnumerator Destroy() { GetComponent <Collider>().enabled = false; if (!(GetComponent <MeshRenderer>() == null)) { GetComponent <MeshRenderer>().enabled = false; } else { Renderer[] rs = GetComponentsInChildren <Renderer>(); foreach (Renderer r in rs) { r.enabled = false; } } yield return(new WaitForSeconds(10f)); Level01Controller.SetCurrentTime(1f); Player.SetAlteredSpeed(speed); // gameObject.SetActive(false); }
public void Awake() { levelController = GameObject.Find("LevelController"); scoreController = levelController.GetComponent <Level01Controller>(); }
private void Awake() { controller = FindObjectOfType <Level01Controller>(); }
public void QuitButton() { Level01Controller level01Controller = new Level01Controller(); level01Controller.ExitLevel(); }
private void Awake() { // insanely illegal method because i don't feel like working with events LOL levelController = FindObjectOfType <Level01Controller>(); colliderToDeactivate = gameObject.GetComponent <Collider>(); }
private void Awake() { _audioSource = GetComponent <AudioSource>(); _lc = FindObjectOfType <Level01Controller>(); _currentPlayerHealth = _totalPlayerHealth; }
// Start is called before the first frame update public void Spawn() { levelController = FindObjectOfType <Level01Controller>(); }