public void OnCollisionStay(Collision collision) { ++eraseNum;//当たった回数 if (waitCount < wait) { return; } waitCount = 0; foreach (var p in collision.contacts) { var canvas = p.otherCollider.GetComponent <InkCanvas>(); if (canvas != null) { canvas.Paint(brush, p.point); HitPoint hitPont = new HitPoint(); hitPont.canvas = canvas; hitPont.point = p.point; hitPont.remainingFrame = 5; hitPointList.Add(hitPont); } } }
public void FixedUpdate() { ++waitCount; for (int i = 0; i < hitPointList.Count; i++) { HitPoint hitPoint = hitPointList[i]; hitPoint.remainingFrame--; if (hitPoint.remainingFrame <= 0) { hitPoint.canvas.Erase(brush, hitPoint.point); hitPointList.RemoveAt(i); } } GameObject tama = GameObject.Find("shell"); GameObject tama2 = GameObject.Find("BBball"); Destroy(tama); Destroy(tama2); }