private void ProcessDamage(GameEntity source, GameEntity target) { var sourceStatDatas = _gameContext.GetEntitiesWithCharacterCharacterStats(source.characterCharacterMetaData.id); if (sourceStatDatas == null) { return; } var sourceStatEntity = sourceStatDatas.FirstOrDefault(); if (sourceStatEntity != null) { if (sourceStatEntity.characterCharacterStats.retainCount > 0) { var sourceDamage = sourceStatEntity.characterCharacterStats.GetStat(CharacterStatId.Damage); if (sourceDamage == null) { return; } var damageValue = sourceDamage.ActiveValue; //do some things fun //critical... //Life Steal... //etc var isCritical = ProcessCritical(sourceStatEntity, target, ref damageValue); ProcessArmor(sourceStatEntity, target, ref damageValue); ProcessLifeSteal(sourceStatEntity, target, ref damageValue); var damageIndicator = new DamageIndicatorData() { targetId = target.characterCharacterMetaData.id, type = IndicatorType.Damage, isCriticalHit = isCritical, value = damageValue, }; var damageIndicatorEntity = _gameContext.CreateEntity(); damageIndicatorEntity.AddIndicatorIndicator(damageIndicator); } } }
public override void InitializeView(Contexts contexts, IEntity entity) { base.InitializeView(contexts, entity); _damageIndicatorData = this._entity.indicatorIndicator.value as DamageIndicatorData; valueText.transform.position = Vector3.zero; if (_damageIndicatorData != null) { valueText.text = "" + _damageIndicatorData.value; if (_damageIndicatorData.isCriticalHit) { valueText.transform.localScale = Vector3.one; valueText.transform.DOScale(new Vector3(1.5f, 1.5f, 1), 0.3f).SetEase(Ease.InBounce); } else { valueText.transform.localScale = Vector3.one; } } valueText.transform.DOMoveY(transform.position.y + 0.5f, 0.3f) .OnComplete(() => { this._entity.isEntityDestroyed = true; }); }