void OnCollisionEnter2D(Collision2D col) { bool bullz = false; if (col.transform.tag == "Obstacle") { BaseScore /= 4; _obstacleHit = true; _effectManager.PlaySFX(AudioClip); //Debug.Log("House hit new base score - " +BaseScore ); } if (col.transform.tag == "Finish") { //Debug.Log("Drop Object Hit"); if (col.transform.position.x > this.transform.position.x - 0.15f && col.transform.position.x < this.transform.position.x + 0.15f && !_obstacleHit) { BaseScore *= 2; bullz = true; //Debug.Log("Bullz eye"); } float score = BaseScore * _dropHeigh; //Debug.Log("Score calc " + BaseScore + " * " + _dropHeigh + " = " + score); ScoreText_script sc = Instantiate(ScoreTextPrefab, this.transform.position, Quaternion.identity, this.transform.parent); sc.Config(bullz, score); _scoreMananger.AddScore(score); Destroy(this.gameObject); } }
void OnCollisionEnter2D(Collision2D col) { if (col.transform.tag == "Obstacle" && !_gameController.IsGameOver && !_noColide) { _dropper.DmgDrop(); EffectManager.PlaySFX(AudioClip); ScoreText_script st = Instantiate(ScoreTextPrefab, this.transform.position, Quaternion.identity, _dropper.DroppObjectHolder); st.Config(false, HitPenelaty); Physics2D.IgnoreLayerCollision(9, 10, true); //sound effect etc _scoreMananger.AddScore(HitPenelaty); StartCoroutine("InvisiFrames"); } }
public void AddScore(float score) { //Debug.Log("Add Score Start"); if (score < 0) //taking damage { MainScore += score; _uiMananger.UpdateScore(MainScore); return; } if (score < 0) { score = (score * 10) / 100; } MainScore += score; EffectManager.PlaySFX(AudioClip); if (MainScore < 0) { MainScore = 0; } //Debug.Log("Add Score - " +temp); GiftDelivered++; _uiMananger.UpdateScore(MainScore); //score sound, effects }