public bool CollidesWith(ObstacleStub other) { if (ObstacleType == ObstacleStubType.BlackHole || ObstacleType == ObstacleStubType.WhiteHole) { if (this.Position == other.Position && (other.ObstacleType == ObstacleStubType.BlackHole || other.ObstacleType == ObstacleStubType.WhiteHole)) { return(true); } return(false); } if (other.ObstacleType == ObstacleStubType.BlackHole || other.ObstacleType == ObstacleStubType.WhiteHole) { return(false); } if (this.ObstacleType == ObstacleStubType.VoidVircle && other.ObstacleType == ObstacleStubType.VoidVircle && this.Position != other.Position) { return(false); } if (this.ObstacleType == ObstacleStubType.MirrorBlock && other.ObstacleType == ObstacleStubType.MirrorBlock && this.Position != other.Position) { return(false); } var g1 = this.GetArea(); var g2 = other.GetArea(); return(g1.Overlaps(g2)); }
public bool CollidesWith(ObstacleStub other) { switch (other.ObstacleType) { case ObstacleStub.ObstacleStubType.BlackHole: case ObstacleStub.ObstacleStubType.WhiteHole: return(false); case ObstacleStub.ObstacleStubType.GlassBlock: case ObstacleStub.ObstacleStubType.MirrorBlock: case ObstacleStub.ObstacleStubType.MirrorCircle: return(this.GetArea().Overlaps(other.GetArea())); case ObstacleStub.ObstacleStubType.VoidVircle: return(false); default: SAMLog.Error("LEPS::EnumSwitch_CW_OS", "other.ObstacleType = " + other.ObstacleType); return(true); } }