Exemplo n.º 1
0
        public void Update(DataPlayer dataPlayer, DataType dataType)
        {
            switch (dataType)
            {
            case DataType.None:
                break;

            case DataType.Money:
                _moneyPlayer = dataPlayer.Money;
                break;

            case DataType.Health:
                _healthPlayer = dataPlayer.Health;
                break;

            case DataType.Power:
                _powerPlayer = dataPlayer.Power;
                break;

            case DataType.Criminal:
                _criminalPlayer = dataPlayer.Criminal;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dataType), dataType, null);
            }

            Debug.Log($"Notified {_name} change to {dataPlayer}");
        }
Exemplo n.º 2
0
        public void Init()
        {
            _enemy = new Enemy("Enemy");

            _dataPlayer = new DataPlayer(nameof(DataPlayer));
            _dataPlayer.Attach(_enemy);

            SubscribeButtons();
        }
Exemplo n.º 3
0
        public void Update(DataPlayer dataPlayer, DataType dataType)
        {
            switch (dataType)
            {
            case DataType.Money:
                _moneyPlayer = dataPlayer.Money;
                break;

            case DataType.Health:
                _healthPlayer = dataPlayer.Health;
                break;

            case DataType.Force:
                _forcePlayer = dataPlayer.Force;
                break;
            }

            Debug.Log($"Notified {_name} change to {dataPlayer}");
        }