示例#1
0
    private void Awake()
    {
        if (!Instance)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        if (!beardLadySB || !fatLadySB || !fireEaterSB || !jugglerSB)
        {
            TDS_CustomDebug.CustomDebugLogError("Missing player's selection button ! Self-destruction of the UIManager");
            Destroy(this);
        }

        if (!mainPlayerH || !mainPlayerP || !otherPlayersHParent)
        {
            TDS_CustomDebug.CustomDebugLogError("Missing player's health refrence ! Self-destruction of the UIManager");
            Destroy(this);
        }

        beardLadySB.onClick.AddListener(() => TDS_GameManager.Instance.Spawn(PlayerCharacter.BeardLady));
        fatLadySB.onClick.AddListener(() => TDS_GameManager.Instance.Spawn(PlayerCharacter.FatLady));
        fireEaterSB.onClick.AddListener(() => TDS_GameManager.Instance.Spawn(PlayerCharacter.FireEater));
        jugglerSB.onClick.AddListener(() => TDS_GameManager.Instance.Spawn(PlayerCharacter.Juggler));

        beardLadySB.interactable = false;
        fatLadySB.interactable   = false;
        fireEaterSB.interactable = false;
        jugglerSB.interactable   = false;

        if (!animator)
        {
            animator = GetComponent <Animator>();
        }

        if (quittingButton && TDS_GameManager.Instance)
        {
            quittingButton.onClick.AddListener(() => Application.Quit());
        }
    }
    // Awake is called when the script instance is being loaded
    private void Awake()
    {
        if (!Instance)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
            photonView.viewID         = 999;
            SceneManager.sceneLoaded += RefreshUI;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        if (!characterSelectionManager)
        {
            characterSelectionManager = GetComponent <TDS_CharacterSelectionManager>();
        }
        uiGameObject = transform.GetChild(0).gameObject;
    }