Inheritance: DefinitionNetworkObject
示例#1
0
文件: Midgard.cs 项目: enBask/Asgard
 public Body CreateBody(BodyDefinition definition)
 {
     var body = new Body(_world, definition.Position, definition.Angle);
     body.BodyType = BodyType.Dynamic;
     body.LinearVelocity = definition.LinearVelocity;
     return body;
 }
示例#2
0
文件: Midgard.cs 项目: enBask/Asgard
        public Physics2dComponent CreateComponent(Entity entity, BodyDefinition definition, bool remoteSync = true)
        {
            var body = CreateBody(definition);

            var component = new Physics2dComponent();
            component.Body = body;
            body.UserData = entity;
            entity.AddComponent(component);

            if (remoteSync)
            {
                ObjectMapper.Create(
                    (uint)entity.UniqueId, typeof(NetPhysicsObject));
            }

            return component;
        }