Ejemplo n.º 1
0
        public WithVoxelWalkerBody(Actor self, WithVoxelWalkerBodyInfo info)
        {
            this.info = info;
            movement  = self.Trait <IMove>();

            var body = self.Trait <BodyOrientation>();

            rv = self.Trait <RenderVoxels>();

            var model = self.World.ModelCache.GetModelSequence(rv.Image, info.Sequence);

            frames         = model.Frames;
            modelAnimation = new ModelAnimation(model, () => WVec.Zero,
                                                () => new[] { body.QuantizeOrientation(self, self.Orientation) },
                                                () => false, () => frame, info.ShowShadow);

            rv.Add(modelAnimation);
        }
Ejemplo n.º 2
0
        public WithVoxelWalkerBody(Actor self, WithVoxelWalkerBodyInfo info)
        {
            this.info = info;
            movement  = self.Trait <IMove>();
            facing    = self.Trait <IFacing>();

            var body = self.Trait <BodyOrientation>();
            var rv   = self.Trait <RenderVoxels>();

            var model = self.World.ModelCache.GetModelSequence(rv.Image, info.Sequence);

            frames = model.Frames;
            rv.Add(new ModelAnimation(model, () => WVec.Zero,
                                      () => new[] { body.QuantizeOrientation(self, self.Orientation) },
                                      () => false, () => frame, info.ShowShadow));

            // Selection size
            var rvi = self.Info.TraitInfo <RenderVoxelsInfo>();
            var s   = (int)(rvi.Scale * model.Size.Aggregate(Math.Max));

            size = new int2(s, s);
        }