сростил проекты
This commit is contained in:
1 parent
a4573f2d12
commit
dfd44aa129
684 files changed
+152796
-67
No files matched your search
@@ -0,0 +1,35 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
public class BonusPickup : MonoBehaviour
|
||||
{
|
||||
public BonusEffect bonusEffect;
|
||||
public float rotationSpeed = 100f;
|
||||
|
||||
private GameObject _originalPrefab;
|
||||
|
||||
public void Init(GameObject prefab)
|
||||
{
|
||||
_originalPrefab = prefab;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
if (BonusManager.Instance != null && bonusEffect != null)
|
||||
{
|
||||
BonusManager.Instance.ActivateBonus(bonusEffect);
|
||||
Debug.Log("бонус подобран");
|
||||
}
|
||||
|
||||
if (_originalPrefab != null)
|
||||
SimpleObjectPool.Instance.ReturnToPool(_originalPrefab, gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user