private void OnTriggerEnter(Collider other) { if (other.transform.CompareTag("Enemy") == true) { other.transform.GetComponent <RoleBaseCtrl>().UpdateHp(-damage); EffectPerform.Instance.ShowDamageUI(damage, other.transform); BuffManager.AddBuffs(other.transform.GetComponent <RoleBaseCtrl>().RoleData, other.transform.GetComponent <ActorBuff>(), buffs); Recycle(); } }
public void CheckHit() { float length = (transform.position - lastPos).magnitude; RaycastHit hitinfo; lastPos = transform.position; if (Physics.Raycast(lastPos, flyDir, out hitinfo, speed * Time.deltaTime, LayerMask.GetMask("Enemy"))) { if (this.buffs != null && hitinfo.transform.CompareTag("Enemy") == true) { hitinfo.transform.GetComponent <EnemyCtrl>().ReduceHealth(damage); EffectPerform.Instance.ShowDamageUI(damage, hitinfo.transform); BuffManager.AddBuffs(hitinfo.transform.GetComponent <RoleBaseCtrl>().RoleData, hitinfo.transform.GetComponent <ActorBuff>(), buffs); Recycle(); } } }
private void DoBuff(Collider[] cols) { if (this.buffId.Count == 0) { return; } List <Buff> buffs = new List <Buff>(); for (int i = 0; i < buffId.Count; i++) { if (buffId[i] != 0) { buffs.Add(BuffManager.GetBuffById(this.buffId[i])); } } for (int i = 0; i < cols.Length; i++) { ActorBuff actorBuff = cols[i].GetComponent <ActorBuff>(); BuffManager.AddBuffs(cols[i].GetComponent <RoleBaseCtrl>().RoleData, actorBuff, buffs); } }