Skip to content

Commit 4f58730

Browse files
committed
Script Update 5
1 parent d71db9f commit 4f58730

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

RandomSpawnInACircle.cs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class ItemDrop : MonoBehaviour
6+
{
7+
public Transform spawnpoint;
8+
public float radius = 23f;
9+
public GameObject player;
10+
11+
void Start()
12+
{
13+
Instantiate(player, RandomSpawn(spawnpoint.position), spawnpoint.rotation);
14+
}
15+
16+
Vector2 RandomSpawn(Vector2 spawnPoint)
17+
{
18+
Vector2 rpoc = Random.insideUnitCircle * radius;
19+
rpoc += spawnPoint;
20+
return rpoc;
21+
}
22+
}

0 commit comments

Comments
 (0)