Score To Decrease On Continuous Time Based Scoring
Hello friends,
I am trying to make a ball bouncing game.
Briefly the gameplay , there will be a ball, there will be a button to make ball bounce and there will be colliders to prevent the ball from exiting the screen. And of course a scoreboard.
As long as the ball is bouncing and not having a collision with colliders. Score will increase continuously, as time passes.
Up to this point, everything is ok.
Additionally I want score to decrease with the increasing speed when the ball collides with colliders (both on enter and stay phases). I tried OnCollisionEnter2D, OnTriggerEnter2D, OnCollisionStay2D, OnTriggerStay2D. I can make Debug.Log texts appear on console screen but I cannot make the score decrease when ball collides.
Below is the codes I used for scoring
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class Score : MonoBehaviour
 {
     public Text scoreText;
     public float scoreAmount;
     public float scoreIncreasedPerSecond;
 
 
     void Start()
     {
         // values for score per second
         scoreAmount = 0f;
         scoreIncreasedPerSecond = 5f;
     }
 
     
     // Update is called once per frame
     void Update()
     {
         //Scoring in 
         scoreText.text = (int)scoreAmount + " Score";
         scoreAmount += scoreIncreasedPerSecond * Time.deltaTime;
     }
 
 }
 
               Could you please support me to make the score decrease and show the decrease on the game screen?
Thanks in advance
Your answer