/// <summary> /// スリップダメージを与える. /// </summary> void TakeSlipDamage(GameObject target, Vector3 effectPos) { foreach (SlippingObjectData objdata in slippingObjects) { if (objdata.target == target) { if (Time.time - objdata.prevTime > slipInterbal) { DamageSender.TakeDamage(target, damage, GetContactPos(target)); objdata.prevTime = Time.time; } break; } } }
/// <summary> /// 当たり判定検知. /// </summary> void OnTriggerEnter(Collider collider) { if (damage.Owner.activeSelf == false) { return; } if (gameObject.activeSelf == false) { return; } GameObject target = CheckIsTargetObject(collider.gameObject); if (target && target.activeSelf) { switch (damage.Kind) { case DamageKind.SLIP: SlippingObjectData data = new SlippingObjectData(target, Time.timeScale); slippingObjects.Add(data); break; case DamageKind.SINGLE: DamageSender.TakeDamage(target, damage, GetContactPos(target)); // 貫通でないなら一度与えた時点で非表示にする. if (damage.HasAttr(DamageAttribute.PENETRATION) == false) { gameObject.SetActive(false); } break; default: break; } } }