public void SetAttackValues(AttackOwner owner, int _damage, int _size, int _knockback, float _range, int _speed, int _health) { attackOwner = owner; damage = _damage; size = _size; knockback = _knockback; range = _range; rangeTimer = Time.time + range; speed = _speed; health = _health; }
private void OnTriggerEnter(Collider other) { LivingBeing thingHit = other.GetComponentInParent <LivingBeing>(); RaycastHit hit; Ray ray = new Ray(transform.position, (other.transform.position - transform.position)); if (thingHit != null) { if (alreadyHit.Contains(thingHit)) { return; } else { alreadyHit.Add(thingHit); } hitInfos = new HitInfos(hitInfos, ray.direction, false); if (AttackOwner is p_PlayerBeing) { Physics.Raycast(ray, out hit, 100f, Game_NG.EnemyLayerMask); hitInfos = new HitInfos(hitInfos, hit.point, true); float blood, madness; ((e_EnemyBeing)thingHit).TakeHit(hitInfos, out blood, out madness); hitInfos = new HitInfos(hitInfos, blood, madness); } else if (AttackOwner is e_EnemyBeing) { Physics.Raycast(ray, out hit, 100f, Game_NG.PlayerLayerMask); hitInfos = new HitInfos(hitInfos, hit.point, true); ((p_PlayerBeing)thingHit).TakeHit(hitInfos); } hitInfos = new HitInfos(hitInfos, thingHit); AttackOwner.SendMessage("OnAttackHit", new HitInfos(hitInfos, thingHit), SendMessageOptions.DontRequireReceiver); maxHitTimes--; if (maxHitTimes <= 0) { Destroy(gameObject); } FX.SpawnHitFX(hitInfos.HitPoint, -hitInfos.Direction, thingHit.transform.parent); } else { Breakable breakableHit = other.GetComponentInParent <Breakable>(); Physics.Raycast(ray, out hit, 100f, Game_NG.AttackableLayerMask); if (breakableHit != null) { breakableHit.TakeHit(new HitInfos(hitInfos, hit.point, ray.direction)); } } }