private void OnTriggerEnter(Collider other) { if (anim.GetBool("isAttacking") && !other.isTrigger) { if (other.CompareTag("Fuel")) { SoundManager.PlaySound("hit"); GameLasting gl = GameObject.Find("GameManager").GetComponent <GameLasting>(); gl.fuel += 1; Destroy(other.gameObject); } if (other.CompareTag("Dasher")) { SoundManager.PlaySound("sizzle"); SoundManager.PlaySound("die"); Destroy(other.gameObject); GameLasting gl = GameObject.Find("GameManager").GetComponent <GameLasting>(); gl.fuel += 1; } if (other.CompareTag("Boss")) { SoundManager.PlaySound("sizzle"); SoundManager.PlaySound("die"); Boss bs = GameObject.Find("Boss").GetComponent <Boss>(); bs.lives--; bs.GetComponent <Renderer>().material.color = Color.red; StartCoroutine(ChangeColor(1)); GameLasting gl = GameObject.Find("GameManager").GetComponent <GameLasting>(); gl.fuel += 1; } } }
// Start is called before the first frame update void Start() { gameLasting = GameObject.Find("GameManager").GetComponent <GameLasting>(); }