I am trying to increase speed value for my enemy only once whenever I reach defined points value in another script.
private void Start()
{
target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}
private void Update()
{
timeInGame += Time.deltaTime;
if (timeInGame <= lifeLength)
{
ChasePlayer();
}
else
{
StopChase();
Destroy(gameObject, 3f);
}
switch (GameController.instance.points)
{
case 10:
readyToSpeedUpEnemy = true;
break;
case 25:
readyToSpeedUpEnemy = true;
break;
default:
break;
}
if (readyToSpeedUpEnemy)
{
speed++;
readyToSpeedUpEnemy = false;
}
}
That being sad - what I am trying to acomplish here is - whenever the "points" value in my GameController script reach 15, 25, 35, etc. points I would like to increase my enemy's speed value by 1.
Can you advise me how to acomplish this, as the above script doesn't work the way I wish?
All your feedback and comments will be appreciated as I am still new in this.
Cheers!