コード例 #1
0
        public void DebugPrint <Comp>(
            EcDictDelta <Comp> ecDictDelta
            ) where Comp : Ecs.INetComponent <Comp>, new()
        {
            Console.WriteLine("        To add:");
            foreach (KeyValuePair <Ecs.Entity, Comp> pair in ecDictDelta.toAdd)
            {
                Ecs.Entity entity = pair.Key;
                Comp       comp   = pair.Value;
                Console.WriteLine("            Entity ID: {0}", entity.id);
                Console.WriteLine("                Component: {0}", comp);
            }

            Console.WriteLine("        To update:");
            foreach (KeyValuePair <Ecs.Entity, Comp> pair in ecDictDelta.toUpdate)
            {
                Ecs.Entity entity = pair.Key;
                Comp       comp   = pair.Value;
                Console.WriteLine("            Entity ID: {0}", entity.id);
                Console.WriteLine("                Component: {0}", comp);
            }

            Console.WriteLine("        To remove:");
            foreach (Ecs.Entity entity in ecDictDelta.toRemove)
            {
                Console.WriteLine("            Entity ID: {0}", entity.id);
            }
        }
コード例 #2
0
        public GameSnapshotDelta(
            GameSnapshot currentSnap,
            GameSnapshot baseSnap
            )
        {
            Tick     = currentSnap.Tick;
            BaseTick = baseSnap.Tick;

            Positions = new EcDictDelta <Ecs.Components.Position>(
                currentSnap.Positions,
                baseSnap.Positions
                );

            ShapeRectangles = new EcDictDelta <Ecs.Components.Shapes.Rectangle>(
                currentSnap.ShapeRectangles,
                baseSnap.ShapeRectangles
                );

            Characters = new EcDictDelta <Ecs.Components.Character>(
                currentSnap.Characters,
                baseSnap.Characters
                );

            Projectiles = new EcDictDelta <Ecs.Components.Projectile>(
                currentSnap.Projectiles,
                baseSnap.Projectiles
                );

            Items = new EcDictDelta <Ecs.Components.Item>(
                currentSnap.Items,
                baseSnap.Items
                );

            Doors = new EcDictDelta <Ecs.Components.Door>(
                currentSnap.Doors,
                baseSnap.Doors
                );

            OrientationCardinals = new EcDictDelta <Ecs.Components.Orientations.Cardinal>(
                currentSnap.OrientationCardinals,
                baseSnap.OrientationCardinals
                );

            Playables = new EcDictDelta <Ecs.Components.Playable>(
                currentSnap.Playables,
                baseSnap.Playables
                );

            Inventories = new EcDictDelta <Ecs.Components.Inventory>(
                currentSnap.Inventories,
                baseSnap.Inventories
                );
        }