rabidus-test/Assets/Scripts/TimeBonus.cs

22 lines
435 B
C#
Raw Normal View History

2023-07-24 16:38:13 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeBonus : MonoBehaviour, ICollectable
{
[SerializeField]
private int _timeBonus;
private vTimerCounter _timerCounter;
private void Awake()
{
_timerCounter = FindObjectOfType<vTimerCounter>();
}
public void Collect()
{
_timerCounter.AddTime(_timeBonus);
Destroy(gameObject);
}
}