Esempio n. 1
0
        public override void Bind(Entity entity, Main main, bool creating = false)
        {
            Bouncer bouncer = entity.GetOrCreate <Bouncer>("Bouncer");

            JointFactory.Bind(entity, main, bouncer.CreateJoint, false, creating, false);

            Components.Joint joint = entity.GetOrCreate <Components.Joint>("Joint");

            bouncer.Add(new Binding <Entity.Handle>(bouncer.Parent, joint.Parent));
            bouncer.Add(new Binding <Voxel.Coord>(bouncer.Coord, joint.Coord));

            DynamicVoxel voxel = entity.Get <DynamicVoxel>();

            voxel.KineticFriction.Value = voxel.StaticFriction.Value = 0;

            bouncer.Add(new CommandBinding(voxel.PhysicsUpdated, delegate()
            {
                bouncer.PhysicsUpdated.Execute(voxel.PhysicsEntity.Mass, voxel.PhysicsEntity.Volume);
            }));

            entity.Add("UVRotation", voxel.UVRotation);
            entity.Add("UVOffset", voxel.UVOffset);
            entity.Add("CannotSuspendByDistance", voxel.CannotSuspendByDistance);
        }