Exemple #1
0
    void Awake()
    {
        _steamUpgradeManager = FindObjectOfType <SteamUpgradeManager>();
        _lidUpgradeManager   = FindObjectOfType <LidUpgradeManager>();
        _teapot = (Instantiate(_teapotPrefab, _spawnLocation, Quaternion.identity) as GameObject).GetComponent <Teapot>();
        _teapot.transform.SetParent(gameObject.transform);


        _steamUpgradeManager.Initialized += () =>
        {
            float currentReloadTime = _steamUpgradeManager.ReloadTime.Current.Value;
            _steamAmmoRemaining = (int)_steamUpgradeManager.ClipSize.Current.Value;

            _steamWeaponView.SetClipSize(_steamAmmoRemaining);

            _steamUpgradeManager.ClipSizeUpgraded += (clipSize) => _steamWeaponView.SetClipSize((int)clipSize.Value);
        };

        _lidUpgradeManager.Initialized += () =>
        {
            float currentReloadTime = _lidUpgradeManager.ReloadTime.Current.Value;
            _lidAmmoRemaining = (int)_lidUpgradeManager.ClipSize.Current.Value;

            _lidWeaponView.SetClipSize(_lidAmmoRemaining);

            _lidUpgradeManager.ClipSizeUpgraded += (clipSize) => _lidWeaponView.SetClipSize((int)clipSize.Value);
        };
    }
    void Awake()
    {
        _steamUpgradeManager = GetComponentInChildren <SteamUpgradeManager>();
        _lidUpgradeManager   = GetComponentInChildren <LidUpgradeManager>();


        //SelectMenuOption((int)UpgradeMenuType.Steam);
    }