void OnCollisionEnter(Collision other) { controller = GetComponentInParent <MovableObjectController>(); if (other.transform.tag == Tags.RideOn || controller == null) { return; } Rigidbody rigidBody = other.transform.GetComponent <Rigidbody>(); if (isOver) { isStop = true; if (rigidBody == null || (other.transform.GetComponent <GraspItem>() == null)) { controller.Burying(); collisionColorObject = other.transform.GetComponent <ColorObjectBase>(); } } else { if (rigidBody == null || (other.transform.GetComponent <GraspItem>() == null)) { if (other.transform == transform) { return; } controller.Collision(); collisionColorObject = other.transform.GetComponent <ColorObjectBase>(); } } }
private void OnCollisionEnter(Collision other) { controller = GetComponentInParent <MovableObjectController>(); if (other.transform.tag == Tags.RideOn || controller == null) { return; } var rigidBody = other.transform.GetComponent <Rigidbody>(); if (isOver) { // カラーブロックが消失状態で重なっている間に再生された // つまり埋まった isStop = true; if (rigidBody == null || (other.transform.GetComponent <GraspItem>() == null)) { // 埋まった時の処理 controller.Burying(); collisionColorObject = other.transform.GetComponent <ColorObjectBase>(); } } else { // 何かにぶつかったので停止 if (rigidBody == null || (other.transform.GetComponent <GraspItem>() == null)) { if (other.transform == transform) { return; } controller.Collision(); collisionColorObject = other.transform.GetComponent <ColorObjectBase>(); } } }
void OnCollisionEnter(Collision other) { controller = GetComponentInParent<MovableObjectController>(); if (other.transform.tag == Tags.RideOn || controller == null) { return; } Rigidbody rigidBody = other.transform.GetComponent<Rigidbody>(); if (isOver) { isStop = true; if (rigidBody == null || (other.transform.GetComponent<GraspItem>() == null)) { controller.Burying(); collisionColorObject = other.transform.GetComponent<ColorObjectBase>(); } } else { if (rigidBody == null || (other.transform.GetComponent<GraspItem>() == null)) { controller.Collision(); collisionColorObject = other.transform.GetComponent<ColorObjectBase>(); } } }