protected override void OnHit(Collision other) { PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects); ContactPoint first = other.GetContact(0); SpawnExplosion(first.point, first.normal); }
private void FixedUpdate() { foreach (var item in tracks) { if (Physics.Raycast(item.position + Vector3.up / 4, Vector3.down / 3, out RaycastHit hit, 1f)) { PaintableMesh.HandlePainting(hit, trackBrush.Texture, trackBrush.Affects); } } }
protected override void OnHit(Collision other) { if (!activated) { StartCoroutine(StartCounter()); } else if (armed) { PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects); Destroy(this.gameObject); } }
protected virtual void OnHit(Collision other) { if ((brush.Affects.value & 1 << other.gameObject.layer) != 0) { PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects); if (hitVFX != null) { var a = Instantiate(hitVFX, other.GetContact(0).point, Quaternion.Euler(other.GetContact(0).normal)); a.Activate(); } if (hitCount == 0) { if (objectDestruction != null) { StopCoroutine(objectDestruction); } rigidbody.velocity = rigidbody.velocity / 100; objectDestruction = StartCoroutine(DestroyAfterTime(0.4f)); } hitCount++; } }