slimecing

a fighting game featuring slimes and swords
Log | Files | Refs | README

Visible.cs (659B)


      1 using System.Collections;
      2 using Slimecing.SOEventSystem.Events;
      3 using UnityEngine;
      4 
      5 namespace Slimecing.SimpleComponents
      6 {
      7     public class Visible : MonoBehaviour
      8     {
      9         [SerializeField] private GameObjectEvent onThingAppear;
     10         [SerializeField] private GameObjectEvent onThingDisappear;
     11 
     12         private void OnEnable()
     13         {
     14             StartCoroutine(ShowObject());
     15         }
     16 
     17         private IEnumerator ShowObject() {
     18             yield return new WaitForSeconds(0.05f);
     19             onThingAppear.Raise(gameObject);
     20         }
     21         private void OnDisable()
     22         {
     23             onThingDisappear.Raise(gameObject);
     24         }
     25     }
     26 }