// 衝突判定を調査する private void Survey() { // objects内の全オブジェクトを検索し,衝突が確認されたオブジェクト間でCollideWithを実行 foreach (var obj in objects) { if (collider.GetIsCollidedWith(obj.collider)) { CollideWith(obj); } } }
public void SpriteNode() { var tc = new TestCore(); tc.Duration = 2000; tc.Init(); var texture = Texture2D.Load(@"../../Core/TestData/IO/AltseedPink.png"); Assert.NotNull(texture); var node = new SpriteNode(); //node.Src = new RectF(new Vector2F(100, 100), new Vector2F(200, 200)); node.Texture = texture; node.AdjustSize(); node.Position = new Vector2F(200, 200); node.CenterPosition = texture.Size / 2; node.Scale = new Vector2F(0.2f, 0.2f); Engine.AddNode(node); var col = new CircleCollider(); col.Radius = 200 * 0.2f; col.Position = node.Position; var node2 = new SpriteNode(); //node.Src = new RectF(new Vector2F(100, 100), new Vector2F(200, 200)); node2.Texture = texture; node2.AdjustSize(); node2.Position = new Vector2F(200, 200); node2.CenterPosition = texture.Size / 2; node2.Scale = new Vector2F(0.2f, 0.2f); Engine.AddNode(node2); var col2 = new CircleCollider(); col2.Radius = 200 * 0.2f; col2.Position = node.Position; tc.LoopBody(c => { node2.Position = col2.Position = Engine.Mouse.Position; if (col.GetIsCollidedWith(col2)) { node2.Angle++; } } , null); tc.End(); }