Exemplo n.º 1
0
    protected virtual void OnEnable()
    {
        if (instance == null)
        {
            instance = this;
        }

        if (!initialized)
        {
            return;
        }
    }
Exemplo n.º 2
0
    protected virtual void OnDestroy()
    {
        if (instance != this)
        {
            return;
        }

        instance = null;

        if (!initialized)
        {
            return;
        }
    }
Exemplo n.º 3
0
    protected virtual void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;

        if (everInitialized)
        {
            throw new System.Exception("Tried to Initialize the SteamManager twice in one session!");
        }

        DontDestroyOnLoad(gameObject);
    }
    private void Start()
    {
        playerActions = PlayerControlActions.CreateWithGamePadBindings();
        gameObject.transform.position = startPosition;

        gradient = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>().GetComponent <GradientImageEffect>();

        menuManager         = GetComponentInChildren <AbstractMenuManager>();
        menuManager.enabled = false;
        menuManager.SetMenuInputActive(false);

        LevelEndManager.levelExitEvent += DeRegister;

        playerActionList = new List <PlayerControlActions>();
        GameObject g = GameObject.FindGameObjectWithTag("GlobalScripts");

        if (g != null)
        {
            playerSelectionContainer = g.GetComponent <PlayerSelectionContainer>();
            if (playerSelectionContainer != null)
            {
                for (int i = 0; i < playerSelectionContainer.playerInputDevices.Length; i++)
                {
                    if (playerSelectionContainer.playerInputDevices[i] != null)
                    {
                        PlayerControlActions p = PlayerControlActions.CreateWithGamePadBindings();
                        p.Device = playerSelectionContainer.playerInputDevices[i];
                        playerActionList.Add(p);
                    }
                }
            }
        }


        steamManager = SteamManager.Instance;
        if (steamManager != null)
        {
            steamManager.OnOverlayActivated += OnOverlayActivated;
        }

        PlayerManager.AllPlayersDeadEventHandler += () => {
            gameEnded = true;
        };
    }