当前位置: 首页>>代码示例>>C#>>正文


C# VRage类代码示例

本文整理汇总了C#中VRage的典型用法代码示例。如果您正苦于以下问题:C# VRage类的具体用法?C# VRage怎么用?C# VRage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VRage类属于命名空间,在下文中一共展示了VRage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream,EndpointId forClient, uint timestamp, int maxBitPosition)
        {
            base.ClientWrite(stream,forClient,timestamp,maxBitPosition);

            stream.Write(Entity.WorldMatrix.Translation);

            MyShipController controller = MySession.Static.ControlledEntity as MyShipController;
            stream.WriteBool(m_grid != null && controller != null);
            if (m_grid != null && controller != null)
            {
                stream.WriteBool(m_grid.IsStatic);
                if (m_grid.IsStatic == false)
                {
                    stream.WriteBool(controller != null);
                    if (controller != null)
                    {
                        stream.WriteInt64(controller.EntityId);

                        Vector2 rotation = controller.RotationIndicator;
                        stream.WriteFloat(rotation.X);
                        stream.WriteFloat(rotation.Y);

                        stream.WriteHalf(controller.RollIndicator);

                        Vector3 position = controller.MoveIndicator;
                        stream.WriteHalf(position.X);
                        stream.WriteHalf(position.Y);
                        stream.WriteHalf(position.Z);

                        Vector3D gridPosition = m_grid.PositionComp.GetPosition();
                        MyGridPhysicsStateGroup.WriteSubgrids(m_grid, stream, ref forClient, timestamp, maxBitPosition, m_lowPositionOrientation, ref gridPosition, ref m_currentSentPosition);
                    }
                }
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:35,代码来源:MyGridPositionVerificationStateGroup.cs

示例2: AddToByteStream

 public void AddToByteStream(VRage.ByteStream stream)
 {
     base.AddToByteStream(stream);
     stream.addLongList(SpawnOwners);
     stream.addString(DisplayName);
     stream.addLongList(BigOwners);
 }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:7,代码来源:ConcealableGrid.cs

示例3: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId,uint timestamp)
        {
            base.ServerRead(stream, clientId, timestamp);
            if (stream.ReadBool())
            {
                if (m_grid != null)
                {
                    bool isStatic = stream.ReadBool();
                    if (isStatic == false)
                    {
                        if (stream.ReadBool())
                        {
                            long entityId = stream.ReadInt64();
                            Vector2 rotation = new Vector2();
                            rotation.X = stream.ReadFloat();
                            rotation.Y = stream.ReadFloat();

                            float roll = stream.ReadHalf();

                            Vector3 move = new Vector3();
                            move.X = stream.ReadHalf();
                            move.Y = stream.ReadHalf();
                            move.Z = stream.ReadHalf();

                            MyShipController controller;
                            if (MyEntities.TryGetEntityById<MyShipController>(entityId, out controller))
                            {
                                controller.CacheMoveAndRotate(ref move, ref rotation, roll);
                            }
                        }
                    }
                }
            }
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:34,代码来源:MyGridPositionVerificationStateGroup.cs

示例4: GetIntersectionWithLine

        //  Calculates intersection of line with any triangleVertexes in this model instance. Closest intersection and intersected triangleVertexes will be returned.
        public override bool GetIntersectionWithLine(ref LineD line, out VRage.Game.Models.MyIntersectionResultLineTriangleEx? t, IntersectionFlags flags = IntersectionFlags.ALL_TRIANGLES)
        {
            t = null;
            return false;

            //Matrix invWorld = Matrix.Invert(WorldMatrix);
            //Vector3 from = Vector3.Transform(line.From, invWorld);
            //Vector3 to = Vector3.Transform(line.To, invWorld);

            //Line lineLocal = new Line(from, to);

            //bool res = base.GetIntersectionWithLine(ref line, out t, flags);

            //if (res)
            //{
            //    var definition = MyDefinitionManager.Static.GetCubeBlockDefinition(new MyDefinitionId(MyObjectBuilderTypeEnum.Ladder));
            //    if (definition.ExcludedAreaForCamera != null)
            //    {
            //        foreach (var b in definition.ExcludedAreaForCamera)
            //        {
            //            if (b.Contains(t.Value.IntersectionPointInObjectSpace) == ContainmentType.Contains)
            //            {
            //                t = null;
            //                return false;
            //            }
            //        }
            //    }
            //}

            //return res;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:32,代码来源:MyLadder.cs

示例5: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream)
        {
            base.ClientWrite(stream);

            MyShipController controller = MySession.Static.ControlledEntity as MyShipController;
            stream.WriteBool(m_grid != null && controller != null);
            if (m_grid != null && controller != null)
            {
                stream.WriteBool(m_grid.IsStatic);
                if (m_grid.IsStatic == false)
                {
                  
                    stream.WriteBool(controller != null);
                    if (controller != null)
                    {
                        stream.WriteInt64(controller.EntityId);

                        Vector2 rotation = controller.RotationIndicator;
                        stream.WriteFloat(rotation.X);
                        stream.WriteFloat(rotation.Y);

                        stream.WriteHalf(controller.RollIndicator);

                        Vector3 position = controller.MoveIndicator;
                        stream.WriteHalf(position.X);
                        stream.WriteHalf(position.Y);
                        stream.WriteHalf(position.Z);
                    }
                }
            }

        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:32,代码来源:MyGridPositionVerificationStateGroup.cs

示例6: deserialize

        public override void deserialize(VRage.ByteStream stream)
        {
            base.deserialize(stream);

            Settings = new ConquestSettings.SETTINGS();

            // Control Points
            ushort cpCount = stream.getUShort();
            Settings.ControlPoints = new List<Records.ControlPoint>();
            for (ushort i = 0; i < cpCount; ++i) {
                Settings.ControlPoints.Add(
                    Records.ControlPoint.deserialize(stream)
                );
            }

            // CP Period
            Settings.CPPeriod = (int)stream.getLong();

            // Cleanup Period
            Settings.CleanupPeriod = (int)stream.getLong();

            // Block Types
            ushort blockTypesLength = stream.getUShort();
            Settings.BlockTypes = new Records.BlockType[blockTypesLength];
            for (ushort i = 0; i < blockTypesLength; ++i) {
                Settings.BlockTypes[i] = Records.BlockType.deserialize(stream);
            }

            // Hull Rules
            ushort hullRulesLength = stream.getUShort();
            Settings.HullRules = new Records.HullRuleSet[hullRulesLength];
            for (ushort i = 0; i < hullRulesLength; ++i) {
                Settings.HullRules[i] = Records.HullRuleSet.deserialize(stream);
            }
        }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:35,代码来源:SettingsResponse.cs

示例7: Set

        internal static void Set(VRage.Common.MyRenderVoxelMaterialData[] list)
        {
            Array.Resize(ref Materials, list.Length);

            for(int i=0; i<list.Length; i++)
            {
                // copy data :O

                Materials[i].Near.ColorMetalXZnY_Texture   = list[i].ColorMetalXZnY;
                Materials[i].Near.ColorMetalpY_Texture     = list[i].ColorMetalY;
                Materials[i].Near.NormalGlossXZnY_Texture  = list[i].NormalGlossXZnY;
                Materials[i].Near.NormalGlosspY_Texture    = list[i].NormalGlossY;
                Materials[i].Near.ExtXZnY_Texture          = list[i].ExtXZnY;
                Materials[i].Near.ExtpY_Texture            = list[i].ExtY;
                Materials[i].Near.TextureScale             = list[i].Scale;

                Materials[i].Far1.ColorMetalXZnY_Texture  = list[i].ColorMetalXZnYFar1;
                Materials[i].Far1.ColorMetalpY_Texture    = list[i].ColorMetalYFar1;
                Materials[i].Far1.NormalGlossXZnY_Texture = list[i].NormalGlossXZnYFar1;
                Materials[i].Far1.NormalGlosspY_Texture   = list[i].NormalGlossYFar1;
                Materials[i].Far1.ExtXZnY_Texture         = list[i].ExtXZnYFar1;
                Materials[i].Far1.ExtpY_Texture           = list[i].ExtYFar1;
                Materials[i].Far1.TextureScale            = list[i].ScaleFar1;

                Materials[i].Far2.ColorMetalXZnY_Texture  = list[i].ColorMetalXZnYFar2;
                Materials[i].Far2.ColorMetalpY_Texture    = list[i].ColorMetalYFar2;
                Materials[i].Far2.NormalGlossXZnY_Texture = list[i].NormalGlossXZnYFar2;
                Materials[i].Far2.NormalGlosspY_Texture   = list[i].NormalGlossYFar2;
                Materials[i].Far2.ExtXZnY_Texture         = list[i].ExtXZnYFar2;
                Materials[i].Far2.ExtpY_Texture           = list[i].ExtYFar2;
                Materials[i].Far2.TextureScale            = list[i].ScaleFar2;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:33,代码来源:VoxelMaterial.cs

示例8: RemoveFromByteStream

 public void RemoveFromByteStream(VRage.ByteStream stream)
 {
     base.RemoveFromByteStream(stream);
     SpawnOwners = stream.getLongList();
     DisplayName = stream.getString();
     BigOwners = stream.getLongList();
 }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:7,代码来源:ConcealableGrid.cs

示例9: deserialize

        public override void deserialize(VRage.ByteStream stream)
        {
            base.deserialize(stream);

            NotificationText = stream.getString();
            Time = stream.getUShort();
            Font = (MyFontEnum)stream.getUShort();
        }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:8,代码来源:NotificationResponse.cs

示例10: EntityComponent

 public EntityComponent(VRage.ByteStream stream)
     : base()
 {
     long entityId = stream.getLong();
     Entity = MyAPIGateway.Entities.GetEntityById(entityId);
     Log = new Logger("SEGarden.Logic.EntityComponent", (() => EntityId.ToString()));
     //Log.Trace("Finished EntityComponent deserialize", "ctr");
 }
开发者ID:zrisher,项目名称:SEGarden,代码行数:8,代码来源:EntityComponent.cs

示例11: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream)
        {
                 
            base.ClientWrite(stream);

            stream.WriteBool(m_character != null);
            if (m_character != null)
            {
                var physGroup = MyExternalReplicable.FindByObject(m_character).FindStateGroup<MyCharacterPhysicsStateGroup>();
                long? supportId = null;
                if (physGroup != null)
                {
                    physGroup.SetSupport(physGroup.FindSupportDelegate());
                    supportId = physGroup.GetSupportId();
                }

                stream.WriteBool(supportId.HasValue);
                if (supportId.HasValue)
                {
                    stream.WriteInt64(supportId.Value);
                }

                Vector3 position = m_character.MoveIndicator;
                stream.WriteHalf(position.X);
                stream.WriteHalf(position.Y);
                stream.WriteHalf(position.Z);

                Vector2 rotate = m_character.RotationIndicator;
                stream.WriteFloat(rotate.X);
                stream.WriteFloat(rotate.Y);

                stream.WriteFloat(m_character.RollIndicator);

                // Movement state, 2B
                stream.WriteUInt16((ushort)m_character.GetNetworkMovementState());
                // Movement flag.
                stream.WriteUInt16((ushort)m_character.PreviousMovementFlags);

                // Flags, 6 bits
                bool hasJetpack = m_character.JetpackComp != null;
                stream.WriteBool(hasJetpack ? m_character.JetpackComp.TurnedOn : false);
                stream.WriteBool(hasJetpack ? m_character.JetpackComp.DampenersTurnedOn : false);
                stream.WriteBool(m_character.LightEnabled); // TODO: Remove
                stream.WriteBool(m_character.ZoomMode == MyZoomModeEnum.IronSight);
                stream.WriteBool(m_character.RadioBroadcaster.WantsToBeEnabled); // TODO: Remove
                stream.WriteBool(m_character.TargetFromCamera);
                stream.WriteFloat(m_character.HeadLocalXAngle);
                stream.WriteFloat(m_character.HeadLocalYAngle);

                if ((hasJetpack && m_character.JetpackComp.TurnedOn) == false)
                {
                    MatrixD matrix = m_character.WorldMatrix;
                    stream.WriteQuaternionNorm(Quaternion.CreateFromForwardUp(matrix.Forward, matrix.Up));
                }
            }        
           
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:57,代码来源:MyCharacterPositionVerificationStateGroup.cs

示例12: ControllableEntity

 // Byte Deserialization
 public ControllableEntity(VRage.ByteStream stream)
     : base(stream)
 {
     Log.ClassName = "GP.Concealment.World.Entities.ControllableEntity";
     IsMoving = stream.getBoolean();
     RecentlyMoved = stream.getBoolean();
     RecentlyMovedEnds = stream.getDateTime();
     Log.Trace("New Controllable Entity " + DisplayName, "ctr");
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:10,代码来源:ControllableEntity.cs

示例13: serialize

 public void serialize(VRage.ByteStream stream)
 {
     stream.addLong((long)Position.X);
     stream.addLong((long)Position.Y);
     stream.addLong((long)Position.Z);
     stream.addString(Name);
     stream.addLong(Radius);
     stream.addLong(TokensPerPeriod);
 }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:9,代码来源:ControlPoint.cs

示例14: Settings

 // Byte Deserialization
 public Settings(VRage.ByteStream stream)
 {
     ControlledMovingGraceTimeSeconds = (ushort)stream.getUlong();
     ControlledMovementGraceDistanceMeters = (ushort)stream.getUlong();
     RevealVisibilityMeters = (ushort)stream.getUlong();
     //RevealDetectabilityMeters = 10; //50;
     //RevealCommunicationMeters = 10; //50;
     //RevealCollisionMeters = 10; //10;
     ConcealNearAsteroids = stream.getBoolean();
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:11,代码来源:Settings.cs

示例15: CubeBlockEffect

 public CubeBlockEffect(VRage.Game.MyObjectBuilder_CubeBlockDefinition.CubeBlockEffect Effect)
 {
     this.Name = Effect.Name;
     this.Origin = Effect.Origin;
     this.Delay = Effect.Delay;
     this.Loop = Effect.Loop;
     this.SpawnTimeMin = Effect.SpawnTimeMin;
     this.SpawnTimeMax = Effect.SpawnTimeMax;
     this.Duration = Effect.Duration;
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:10,代码来源:MyCubeBlockDefinition.cs


注:本文中的VRage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。