mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
29 lines
791 B
C#
29 lines
791 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class MemRenderer : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField] private GameObject[] prefabs;
|
||
|
[SerializeField] private float rotationDegreesPerSecond = 15f;
|
||
|
GameObject _instance;
|
||
|
|
||
|
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
_instance = Instantiate(prefabs[UnityEngine.Random.Range(0, prefabs.Length)], transform);
|
||
|
}
|
||
|
|
||
|
public void ChangeMem()
|
||
|
{
|
||
|
Destroy(_instance);
|
||
|
_instance = Instantiate(prefabs[UnityEngine.Random.Range(0, prefabs.Length)], transform);
|
||
|
}
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
_instance.transform.eulerAngles = new Vector3(0, _instance.transform.eulerAngles.y + (rotationDegreesPerSecond * Time.deltaTime), 0);
|
||
|
}
|
||
|
}
|