2023-07-24 16:38:13 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2023-08-01 11:28:14 +03:00
|
|
|
public class TimeBonus : MonoBehaviour, IInteractable
|
2023-07-24 16:38:13 +03:00
|
|
|
{
|
|
|
|
[SerializeField]
|
|
|
|
private int _timeBonus;
|
2023-07-28 11:48:57 +03:00
|
|
|
[SerializeField]
|
|
|
|
private bool _selfDestroy = true;
|
2023-07-24 16:38:13 +03:00
|
|
|
|
|
|
|
private vTimerCounter _timerCounter;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_timerCounter = FindObjectOfType<vTimerCounter>();
|
|
|
|
}
|
|
|
|
|
2023-08-01 11:28:14 +03:00
|
|
|
public void Interact()
|
2023-07-24 16:38:13 +03:00
|
|
|
{
|
|
|
|
_timerCounter.AddTime(_timeBonus);
|
2023-07-28 11:48:57 +03:00
|
|
|
if (_selfDestroy)
|
|
|
|
Destroy(gameObject);
|
2023-07-24 16:38:13 +03:00
|
|
|
}
|
|
|
|
}
|