Ejemplo n.º 1
0
        protected override void Load()
        {
            EveryUpdate
            .Subscribe(_ => transform.LookAt(Vector3.zero))
            .AddTo(_disposables);

            _collision.OnTriggerEnterAsObservable()
            .Where(it => it.CompareTag("CircleOfFire"))
            .Do(_ => canMove = false)
            .Subscribe()
            .AddTo(_disposables);

            _collision.OnTriggerExitAsObservable()
            .Where(it => it.CompareTag("CircleOfFire"))
            .Do(_ => canMove = true)
            .Subscribe()
            .AddTo(_disposables);

            EveryUpdate
            .Where(_ => canMove)
            .Subscribe(_ => transform.Translate(Vector3.forward * Time.deltaTime))
            .AddTo(_disposables);


            Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1f))
            .Do(_ => Jump(true))
            .Wait(0.5f)
            .Do(_ => Jump(false))
            .Subscribe()
            .AddTo(_disposables);
        }
Ejemplo n.º 2
0
        protected override void Load()
        {
            _allHumedals = FindObjectsOfType <Humedal>().ToList();

            EveryUpdate
            .Where(_ => _allHumedals.All(it => it.IsBurnt()))
            .First()
            .Subscribe(_ => EventStream.Send(Events.Defeat()));
        }
Ejemplo n.º 3
0
        private void GoTowardsNearestHumedalSubscription()
        {
            EveryUpdate
            .Where(_ => _beingKnockedBackTimer <= 0)
            .Select(_ => FindClosestAliveHumedal())
            .Where(HumedalIsNotNull)
            .Subscribe(MoveTowardsTarget)
            .AddTo(_disposables);

            EveryUpdate
            .Where(_ => _beingKnockedBackTimer > 0)
            .Do(_ => _beingKnockedBackTimer -= Time.deltaTime)
            .Subscribe()
            .AddTo(_disposables);
        }
Ejemplo n.º 4
0
        protected override void Load()
        {
            _humedales = FindObjectsOfType <Humedal>().ToList();

            _actualHumedal     = FindClosestAliveHumedal();
            transform.position = _actualHumedal.transform.position;
            GenerateRandomPosition();

            EveryUpdate
            .Where(_ => !_actualHumedal.IsBurnt())
            .Where(_ => canMove)
            .Subscribe(_ => JumpAroundHumedal())
            .AddTo(_disposables);

            EveryUpdate
            .Where(_ => _actualHumedal.IsBurnt())
            .Subscribe(_ => GoToOtherHumedal())
            .AddTo(_disposables);
        }