// クリエイターとサポートパネルのセット化 public BombCreater CreatorAndSupportSet(ObjectBase.ColliderSet support) { for (int i = 0; i < bCNum; i++) { if (Mathf.Abs(support.pos.position.x - c_BombCreater[i].colliderSet.pos.position.x) < support.myRect.width / 2 + c_BombCreater[i].colliderSet.myRect.width / 2) { return(c_BombCreater[i].GetComponent <BombCreater>()); } } return(null); }
//-------------------------------------------------------- // コライダー //-------------------------------------------------------- static public bool Collider(ObjectBase.ColliderSet a, ObjectBase.ColliderSet b) { float zeA = Mathf.Abs((a.pos.position.x + a.myRect.x) - (b.pos.position.x + b.myRect.x)); float zeB = Mathf.Abs((a.pos.position.y + a.myRect.y) - (b.pos.position.y + b.myRect.y)); // 衝突していたら if (zeA < ((a.myRect.width / 2) + (b.myRect.width / 2)) && zeB < (a.myRect.height / 2 + b.myRect.height / 2)) { return(true); } else { return(false); } }