Added Decorations
This commit is contained in:
39
Assets/Scripts/DamianExperiments/Minigame/TrashSpawner.cs
Normal file
39
Assets/Scripts/DamianExperiments/Minigame/TrashSpawner.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class TrashSpawner : MonoBehaviour
|
||||
{
|
||||
// Assign in inspector: the pool of sprites to choose from
|
||||
public Sprite[] spritePool;
|
||||
[Tooltip("Visual radius for spawn point in editor")]
|
||||
public float gizmoRadius = 0.5f;
|
||||
|
||||
// Visual indicator for editor only
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.cadetBlue;
|
||||
Gizmos.DrawWireSphere(transform.position, gizmoRadius);
|
||||
|
||||
// Draw a cross in the center for better visibility
|
||||
Gizmos.DrawLine(
|
||||
transform.position + Vector3.left * gizmoRadius * 0.5f,
|
||||
transform.position + Vector3.right * gizmoRadius * 0.5f);
|
||||
Gizmos.DrawLine(
|
||||
transform.position + Vector3.up * gizmoRadius * 0.5f,
|
||||
transform.position + Vector3.down * gizmoRadius * 0.5f);
|
||||
}
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
var sr = GetComponent<SpriteRenderer>();
|
||||
if (spritePool != null && spritePool.Length > 0 && sr != null)
|
||||
{
|
||||
sr.sprite = spritePool[Random.Range(0, spritePool.Length)];
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edd79c7026d196b49867a3ed7e7828b3
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class decorationSpawner : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 711fdad9f8a4ece45aeed22006b3e4f4
|
||||
Reference in New Issue
Block a user