コード例 #1
0
ファイル: Factory.cs プロジェクト: AyyTee/Aventyr
        private static Actor CreateEntityBox(Entity entity, Transform2 transform)
        {
            entity.IsPortalable = true;
            entity.AddModel(ModelFactory.CreatePlane(transform.Scale));

            Vector2[] vertices = new Vector2[] {
                new Vector2(-0.5f, -0.5f),
                new Vector2(0.5f, -0.5f),
                new Vector2(0.5f, 0.5f),
                new Vector2(-0.5f, 0.5f)
            };
            Actor actor = new Actor(entity.Scene, vertices, transform);
            actor.Body.BodyType = BodyType.Dynamic;
            entity.SetParent(actor);

            Transform2 t = new Transform2();
            t.Position = transform.Position;
            t.Rotation = transform.Rotation;
            actor.SetTransform(t);
            return actor;
        }