Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Enemy_Collectable_Drop : MonoBehaviour
- {
- [SerializeField]
- private float chanceOfCollectableDrop;
- private Collectable_Spawner _collectableSpawner;
- private void Awake()
- {
- _collectableSpawner = FindObjectOfType<Collectable_Spawner>();
- }
- public void RandomlyDropCollectable()
- {
- float random = Random.Range(0, 1f);
- if (random >= chanceOfCollectableDrop)
- {
- _collectableSpawner.SpawnCollectable(transform.position);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement