private void OnTriggerEnter2D(Collider2D collision) { Wall hitWall = collision.gameObject.GetComponent <Wall>(); if (hitWall.color == playerColor) { hitWall.Clear(); StartCoroutine(SuccessHit()); if (health.value < 10) { health.value++; } } else { hitWall.Fail(); StartCoroutine(FailHit()); if (health.value > 0) { health.value--; } if (health.value == 0) { StartCoroutine(OtherControls.GameOver()); } } }
// Use this for initialization void Start() { tempGO = GameObject.FindGameObjectWithTag("Player"); shaderDiffuse = Shader.Find("Diffuse"); shaderIllumin = Shader.Find("Self-Illumin/Bumped Diffuse"); controls = (OtherControls)tempGO.GetComponent("OtherControls"); }