private void OnCollisionEnter2D(Collision2D collision) { Enemy Enemy = collision.gameObject.GetComponent <Enemy>(); if (Enemy == null) { return; } Health -= Enemy.Attack; CD.choice = 1; //CD.health = Health; CD.IncrementScore(Enemy.Attack); Audio.clip = oof; Audio.Play(); Debug.Log("oof"); }
void Update() { isPicked = doesPick.IsTouchingLayers(isPickedLayer); if (isPicked && !dead) { dead = true; Audio.clip = added; Audio.Play(); Debug.Log("added"); transform.position = Vector3.one * 9999f; Destroy(gameObject, Audio.clip.length); CD.choice = 0; //CD.heart += Value; CD.IncrementScore(Value); } }
void Update() { isArrowed = doesArrow.IsTouchingLayers(isArrowedLayer); if (isArrowed) { Health -= 1; } if (Health == 0) { Health--; Audio.clip = ded; Audio.Play(); Debug.Log("ded"); Heart h = Instantiate(heart, new Vector2(transform.position.x, transform.position.y), Quaternion.identity).GetComponent <Heart>(); transform.position = Vector3.one * 9999f; Destroy(gameObject, Audio.clip.length); CD.choice = 2; //CD.score += Value; CD.IncrementScore(Value); } }