示例#1
0
    protected override void DoInit(BaseEntityDependencies deps)
    {
        base.DoInit(deps);

        _absorbEvents = ((KrbGameEvents)deps.GameEvents).Absorption;

        _healthEvents = deps.GameEvents.Health;

        _healthEvents.HealthEvent += OnHealthEvent;

        _krbMonsterData = (KrbMonsterData)_monsterData;
        _absorptionData = _krbMonsterData.AbsorptionData;
    }
示例#2
0
    protected override void DoInit(BaseEntityDependencies deps)
    {
        _playerData = ((PlayerData)_entityData);

        name     = "Player";
        _hpTrait = new HPTrait();
        _hpTrait.Init(this, _playerData.HPData, deps.GameEvents.Health);

        _speed = _playerData.Speed;

        _movingTrait = _playerData.MovingTraitData.CreateRuntimeTrait();

        _playerEvents = deps.GameEvents.Player;
        _healthEvents = deps.GameEvents.Health;
        _healthEvents.HealthExhausted += OnDied;

        _battleTrait = new BattleTrait();
        _battleTrait.Init(_entityController, _mapController, _playerData.BattleData, this, deps.GameEvents);
    }