예제 #1
0
파일: Sprite2D.cs 프로젝트: bikrone/hexagon
 public void SetCollider(PolygonCollider collider)
 {
     this.Collider = collider;
 }
예제 #2
0
        private void AddHexagonCollider(Sprite2D sprite)
        {
            PolygonCollider collider = new PolygonCollider();
            collider.AddVertex(new Vector2(0, sprite.Height / 2.0f));
            collider.AddVertex(new Vector2(sprite.Width/4.0f, 0));
            collider.AddVertex(new Vector2(0.75f*sprite.Width, 0));
            collider.AddVertex(new Vector2(sprite.Width, sprite.Height / 2.0f));
            collider.AddVertex(new Vector2(0.75f * sprite.Width, sprite.Height));
            collider.AddVertex(new Vector2(sprite.Width / 4.0f, sprite.Height));

            sprite.SetCollider(collider);
        }