예제 #1
0
 private void Start()
 {
     Enabled.Subscribe(() =>
     {
         Targets.ForEach(t => t.enabled = Enabled.Value);
     });
 }
예제 #2
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        InputManager.Instance.onRestartScene += () =>
        {
            RestartScene();
        };

        InputManager.Instance.onStart += () =>
        {
            if (_isPlayerDead.Value)
            {
                _deathText.SetActive(false);
                RestartScene();
            }
        };

        _isPlayerDead.Subscribe(TryEnableDeathText);

        DistanceText       = DistanceTextTransform.Value.GetComponent <TMP_Text>();
        distanceTextPrefix = DistanceText.text;

        shrineText       = ShrineTextTransform.Value.GetComponent <TMP_Text>();
        shrineTextPrefix = shrineText.text;

        TrySpawnBoss();
        _playerShrinesVisited.Subscribe(TrySpawnBoss);

        if (UseRandomSeed)
        {
            UnityRandomSeed = Random.state.GetHashCode();
        }
        Random.InitState(UnityRandomSeed);

        MapMagicObject mapMagic = MapMagicSceneReference.Value.GetComponent <MapMagicObject>();

        if (GenerateRandomSeed || mapMagic.graph.random.Seed == 0)
        {
            mapMagic.graph.random.Seed = Random.Range(10000, 9999999);
            mapMagic.Refresh();
        }
        if (UseSetSeed)
        {
            mapMagic.graph.random.Seed = int.Parse(Seed);
            mapMagic.Refresh();
        }
    }
예제 #3
0
        public override void Enter()
        {
            base.Enter();

            if (SetOnEnter)
            {
                UpdateValue();
            }

            if (SetOnUpdate)
            {
                Value.Subscribe(UpdateValue);
            }
        }
예제 #4
0
 private void OnEnable()
 {
     PlayerHeight.Subscribe(OnHeightChanged);
     Reset.Subscribe(OnResetRequest);
 }