mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-15 14:15:07 +00:00
30 lines
823 B
C#
30 lines
823 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()
|
||
|
{
|
||
|
Debug.Log("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);
|
||
|
}
|
||
|
}
|