} // end Update public void Recycling() { damage = null; foreach (TrailRenderer trail in GetComponentsInChildren<TrailRenderer>()) { trail.Clear(); } // end foreach InstanceMgr.GetObjectManager().Recycling(poolName, gameObject); } // end Recycling
} // end CheckAttributeData public override void UnderAttack(IDamageData damage) { if (null == damage) return; // end if IRealData realData = new RealData(damage, m_charcterData); m_charcterData.Minus(realData); Vector2 screenPoint = SceneManager.mainCamera.camera.WorldToScreenPoint(character.helpTransform.position); Vector2 hud_pos; if (RectTransformUtility.ScreenPointToLocalPointInRectangle(SceneManager.mainCanvas.HUD_rectTRansform, screenPoint, SceneManager.mainCanvas.camera, out hud_pos)) { HUD_Damage hud = InstanceMgr.GetObjectManager().GetGameObject<HUD_Damage>(HUD_Damage.poolName); hud.SetNumber(realData.HP); hud.transform.SetParent(SceneManager.mainCanvas.HUD_rectTRansform, false); hud.transform.localPosition = hud_pos; hud.gameObject.SetActive(true); } // end if if (null != lockCharacter) return; // end if if (damage.hashID == SceneManager.mainCharacter.hashID) { LockCharacter(SceneManager.mainCharacter); return; } // end if ICharacter npc = SceneManager.characterManager.factory.GetNPCharacter(damage.hashID); if (null != npc) { LockCharacter(npc); } // end if } // end UnderAttack
} // end RealData public RealData(IDamageData damage, ICharacterData target) { if (null == damage || null == target) { ismiss = true; return; } // end if ismiss = UnityEngine.Random.Range(0, 100f + damage.HIT) < target.AVD; HP = MathTool.LimitZero(damage.ATK - MathTool.Percent(target.DEF, damage.DEFR + 100f)) + MathTool.LimitZero(damage.MGK - MathTool.Percent(target.RGS, damage.RGSR + 100f)); } // end RealData
public virtual void ReceiveDamage(IDamageData damageData) { if (useLog) { Debug.Log($"{Name} {nameof(ReceiveDamage)} {damageData}"); } healthController.ReceiveDamage(damageData.Damage); if (healthController.CurrentHealth <= 0.0f) { Kill(new KillerInfo(damageData.DamageOwner, damageData.DamageSource)); } }
} // end Awake public void SetDamage(IDamageData damage) { this.damage = damage; } // end SetDamage
} // end LockCharacter public override void UnderAttack(IDamageData data) { IRealData realData = new RealData(data, m_charcterData); m_charcterData.Minus(realData); } // end UnderAttack
} // end OnEnable public void SetDamage(string poolName, IDamageData damage) { this.poolName = poolName; this.damage = damage; } // end SetDamage
public void ReceiveDamage(IDamageData damageData) => damageable.ReceiveDamage(damageData);
public DamageDataComponent(IDamageData data) { _data = data; }
public abstract void UnderAttack(IDamageData data);
public Damager(IDamageData data, IBehaviourController controller) { this.data = data; this.controller = controller; }
} // end Update public void Recycling() { damage = null; InstanceMgr.GetObjectManager().Recycling(poolName, gameObject); } // end Recycling