public void Impact() { OnPreDamage(); OnDamageEvent(); OnImpact.Invoke(); }
public void OnCollisionEnter(Collision collision) { ContactPoint contactPoint = collision.contacts[0]; if (contactPoint.otherCollider.CompareTag("Player")) { LastImpactType = ImpactType.Finger; LastOtherCollider = contactPoint.otherCollider; LastImpactIntensity = collision.relativeVelocity.magnitude; // Finger impacts get set to 1 regardless of actual intensity FingerImpactIntensity += Mathf.Max(LastImpactIntensity, minFingerImpactIntensity); OnImpact?.Invoke(this, contactPoint.point); } else if (contactPoint.otherCollider.CompareTag("VolumeBlock")) { float impactVelocity = collision.relativeVelocity.magnitude; if (impactVelocity < minCollisionVelocity) { return; } impactVelocity = Mathf.Max(impactVelocity, minChunkImpactIntensity); LastImpactType = ImpactType.OtherBlock; LastOtherCollider = contactPoint.otherCollider; LastImpactIntensity = impactVelocity; ChunkImpactIntensity += impactVelocity; OnImpact?.Invoke(this, contactPoint.point); } }
public virtual void OnCollisionEnter(Collision col) { if (OnImpact != null) { OnImpact.Invoke(col); } GameObject.Destroy(gameObject); }
private void OnCollisionEnter(Collision collision) { // Let's not hit ourselves if (collision.collider.transform.root == transform.root) { return; } if (collision.relativeVelocity.sqrMagnitude > sqrVelocityThreshold) { OnImpact?.Invoke(); AudioManager.PlaySoundNonSpatial(null); } }
public override void OnFallToGround(double motionY) { IPlayer player = World.PlayerByUid(PlayerUID); if (player?.WorldData?.CurrentGameMode != EnumGameMode.Spectator) { EntityPos pos = SidedPos; int blockIdUnder = BlockUnderPlayer(pos); AssetLocation soundwalk = World.Blocks[blockIdUnder].GetSounds(Api.World.BlockAccessor, new BlockPos((int)pos.X, (int)(pos.Y - 0.1f), (int)pos.Z))?.Walk; if (soundwalk != null && !Swimming) { World.PlaySoundAt(soundwalk, this, player, true, 12, 1.5f); } OnImpact?.Invoke(motionY); } base.OnFallToGround(motionY); }
private void OnTriggerEnter(Collider other) { if (_hasDealtDamage) { return; } var collisionManager = ManagerLocator.TryGet <HitManager>(); collisionManager?.ReportHit(other.gameObject, transform.position, damage); _hasDealtDamage = true; OnImpact?.Invoke(); if (destroySelfOnImpact) { Destroy(gameObject); } }
public void OnCollisionEnter(Collision collision) { OnImpact?.Invoke(); }
private void Impact() { OnImpact?.Invoke(); }
public void Impact() { OnImpact?.Invoke(); }
public void TriggerImpact(Collision collision) { OnImpact?.Invoke(collision); }
public virtual void OnHit() { OnImpact?.Invoke(this); }