58 lines
1.2 KiB
C#
58 lines
1.2 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
public class ObjectDisplay : MonoBehaviour
|
|
{
|
|
public GameObject objectA;
|
|
public GameObject objectB;
|
|
public GameObject objectC;
|
|
public Material materialB;
|
|
|
|
public float delayForA = 1f;
|
|
public float delayForB = 10f;
|
|
public float delayForC = 15f;
|
|
public float delayForMaterialChange = 20f;
|
|
|
|
|
|
public void StartDisplaySequence()
|
|
{
|
|
StartCoroutine(DisplaySequence());
|
|
}
|
|
|
|
private IEnumerator DisplaySequence()
|
|
{
|
|
|
|
objectB.SetActive(false);
|
|
objectC.SetActive(false);
|
|
|
|
|
|
yield return new WaitForSeconds(delayForA);
|
|
objectA.SetActive(true);
|
|
|
|
|
|
yield return new WaitForSeconds(delayForB - delayForA);
|
|
objectA.SetActive(false);
|
|
objectB.SetActive(true);
|
|
|
|
|
|
yield return new WaitForSeconds(delayForC - delayForB);
|
|
objectB.SetActive(false);
|
|
objectC.SetActive(true);
|
|
|
|
|
|
yield return new WaitForSeconds(delayForMaterialChange - delayForC);
|
|
|
|
|
|
ChangeMaterial();
|
|
}
|
|
|
|
private void ChangeMaterial()
|
|
{
|
|
Renderer renderer = objectA.GetComponent<Renderer>();
|
|
if (renderer != null)
|
|
{
|
|
renderer.material = materialB;
|
|
}
|
|
}
|
|
}
|