using System;
using UnityEngine;
using UnityEngine.Events;

/// <summary>
/// Default organization concept for all custom scripts in this project.
/// </summary>
public class NewEmptyScript : MonoBehaviour
{
    /* Events */
    //
    // Example event Action, works like a hub as in communication something to everything else
    public static event Action Event_Example;
    public static event Action<bool> Event_ExampleWithT;
    //
    // Example UnityEvent, buttons use them for example
    public UnityEvent UnityEvent_Example;
    //



    /* Singleton */
    //
    // Example on how to create an instance of some class
    public static NewEmptyScript Instance;
    //



    /* References */
    //
    // References to other game objects, components, audio files, etc...
    [Header("References")]
    [SerializeField]
    private GameObject go_Example;
    //



    /* Parameters */
    //
    // All parameters of this class
    [Header("Example1")]
    private string exampleString1;
    //
    [SerializeField]
    private string exampleStringEditableInEditor;
    //


    [Header("Example2")]
    private string exampleString2;
    //
    [SerializeField]
    private int exampleIntegerEditableInEditor;
    //



    /* Unity Methods */
    //
    // All Unity related methods, with the order being as follows (inspired by https://docs.unity3d.com/Manual/ExecutionOrder.html):
    //
    // Awake, OnEnable/OnDisable, Start, FixedUpdate, OnTriggerX, OnCollisionX, OnMouse, Update, LateUpdate,
    // [...], OnDrawGizmos, OnGUI, OnApplicationPause, OnApplicationQuit, OnDisable, OnDestroy
    // 
    // How to have only one public static "Instance" at a time, while one game object should never have 2 "Instance"s as components:
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
    //



    /* Custom Methods */
    //
    // All custom methods can be sorted into regions, sorted from public to private and non-void to void
    //
    #region ExampleRegion
    public float GetSomeFloat()
    {
        return 3.14f;
    }

    public void OutsidersCanCallThis()
    {
        UnityEvent_Example?.Invoke();
    }

    private int GetSomeInt()
    {
        return 0;
    }

    private void OnlyICanCallThis()
    {
        Event_Example?.Invoke();
        Event_ExampleWithT?.Invoke(true);
    }

    #endregion
}