Exemplo n.º 1
0
    private void Start()
    {
        _enemy = new Enemy("Enemy Flappy");

        _money = new Money(nameof(Money));
        _money.Attach(_enemy);

        _heath = new Health(nameof(Health));
        _heath.Attach(_enemy);

        _power = new Force(nameof(Force));
        _power.Attach(_enemy);

        _properties[DataType.Money].SubscribeButton(_minusCoinsButton, _addCoinsButton);
        _properties[DataType.Health].SubscribeButton(_minusHealthButton, _addHealthButton);
        _properties[DataType.Force].SubscribeButton(_minusPowerButton, _addPowerButton);
        _properties[DataType.Crime].SubscribeButton(_minusCrimeButton, _addCrimeButton);

        foreach (DataType type in System.Enum.GetValues(typeof(DataType)))
        {
            _properties[type].OnClickObserver += ChangeDataWindow;
        }

        _fightButton.onClick.AddListener(Fight);
        _escapeButton.onClick.AddListener(Escape);
    }
Exemplo n.º 2
0
        public void Init(CurrencyView currencyView)
        {
            _enemy = new Enemy("Enemy Flappy");

            _money = new Money(nameof(Money));
            _money.Attach(_enemy);

            _heath = new Health(nameof(Health));
            _heath.Attach(_enemy);

            _force = new Force(nameof(Force));
            _force.Attach(_enemy);

            _crimeRate = new CrimeRate(nameof(CrimeRate));
            _crimeRate.Attach(_enemy);

            _currencyView = currencyView;

            _cameraShaker = new CameraShakeBehaviour();

            _addHealthButton.onClick.AddListener(() => ChangeHealth(true));
            _minusHealthButton.onClick.AddListener(() => ChangeHealth(false));

            _addPowerButton.onClick.AddListener(() => ChangeForce(true));
            _minusPowerButton.onClick.AddListener(() => ChangeForce(false));

            _addCrimeRateButton.onClick.AddListener(() => ChangeCrimeRate(true));
            _minusCrimeRateButton.onClick.AddListener(() => ChangeCrimeRate(false));

            _fightButton.onClick.AddListener(Fight);
            _skipButton.onClick.AddListener(Skip);
        }
Exemplo n.º 3
0
    public void RefreshView()
    {
        _enemy = new Enemy("Enemy Flappy");

        _money = new Money(nameof(Money));
        _money.Attach(_enemy);

        _heath = new Health(nameof(Health));
        _heath.Attach(_enemy);

        _force = new Force(nameof(Force));
        _force.Attach(_enemy);

        SubscribeButtons();
    }