/// <summary> /// 2つの四角形領域に交わっている箇所があるかどうか判定する。 /// </summary> /// <param name="a">比較する四角領域a。</param> /// <param name="b">比較する四角領域b。</param> /// <returns>交わっている箇所があるならばtrue、そうでなければfalse。</returns> public static bool IsIntersected(IRectBounds a, IRectBounds b) { var uy = b.GetNorthEastY(); var ux = b.GetNorthEastX(); var dy = b.GetSouthWestY(); var dx = b.GetSouthWestX(); var northY = a.GetNorthEastY(); var southY = a.GetSouthWestY(); var westX = a.GetSouthWestX(); var eastX = a.GetNorthEastX(); if (ux >= westX && ux <= eastX && uy >= northY && uy <= southY || dx >= westX && dx <= eastX && uy >= northY && uy <= southY || ux >= westX && ux <= eastX && dy >= northY && dy <= southY || dx >= westX && dx <= eastX && dy >= northY && dy <= southY) { return(true); } else { return(false); } }
public bool IsHitted(IRectBounds c) { for (int i = 0; i < this.drawList.Count; i = i + 1) { var d = this.drawList[i]; if (d.IsHitted(c)) { d.Crash(); this.shotList.Add(d); this.drawList.RemoveAt(i); return(true); } } return(false); }
public override bool IsHitted(IRectBounds c) { return(ShootingUtils.IsIntersected(this, c)); }
public bool IsHitted(IRectBounds c) { /// 未実装 return(ShootingUtils.IsIntersected(this, c)); }
public abstract bool IsHitted(IRectBounds c);