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


C# Character.MyCharacter类代码示例

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


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

示例1: AfterCharacterCreate

        // CH: TODO: This is here just temporarily. We should move it to a better place later
        public virtual void AfterCharacterCreate(MyCharacter character) {
			if (MyFakes.ENABLE_MEDIEVAL_INVENTORY)
			{
				character.InventoryAggregate = new Sandbox.Game.Entities.Inventory.MyInventoryAggregate();
				character.InventoryAggregate.AddComponent(new Sandbox.Game.Entities.Inventory.MyInventoryAggregate());
			}
		}
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:8,代码来源:MyBuildComponentBase.cs

示例2: AddItems

        private void AddItems(MyCharacter character)
        {
            character.GetInventory(0).Clear();

            var ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(StartingWeaponId.SubtypeName);
            if (character.WeaponTakesBuilderFromInventory(StartingWeaponId))            
            {
                character.GetInventory(0).AddItems(1, ob);
            }

            if (HumanoidDefinition.InventoryContentGenerated && MyFakes.ENABLE_RANDOM_INVENTORY)
            {

                MyContainerTypeDefinition cargoContainerDefinition = MyDefinitionManager.Static.GetContainerTypeDefinition(HumanoidDefinition.InventoryContainerTypeId.SubtypeName);
                    if (cargoContainerDefinition != null)
                    {
                        character.GetInventory(0).GenerateContent(cargoContainerDefinition);
                    }
                    else
                    {
                        Debug.Fail("CargoContainer type definition " + HumanoidDefinition.InventoryContainerTypeId + " wasn't found.");
                    }
            }
            else
            {
                foreach (var weaponDef in HumanoidDefinition.InventoryItems)
                {
                    ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(weaponDef.SubtypeName);
                    character.GetInventory(0).AddItems(1, ob);
                }
            }

            character.SwitchToWeapon(StartingWeaponId);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:34,代码来源:MyHumanoidBot.cs

示例3: MyBattery

        public MyBattery(MyCharacter owner)
        {
            m_owner = owner;
            SyncObject = new MySyncBattery(this);
			ResourceSink = new MyResourceSinkComponent();
			ResourceSource = new MyResourceSourceComponent();
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyBattery.cs

示例4: SendCapacitySync

        public void SendCapacitySync(MyCharacter owner, float remainingCapacity)
        {
            var msg = new CapacitySyncMsg();

            msg.EntityId = owner.EntityId;
            msg.RemainingCapacity = remainingCapacity;

            Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MySyncBattery.cs

示例5: RequestUse

            public void RequestUse(UseActionEnum actionEnum, MyCharacter user)
            {
                var msg = new UseMsg();

                msg.EntityId = m_block.EntityId;
                msg.UsedByEntityId = user.EntityId;
                msg.ActionEnum = actionEnum;

                Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);

            }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:11,代码来源:MyMedicalRoom.cs

示例6: UpdateLose

 public bool UpdateLose(MyCharacter me)
 {
     foreach (var trigger in m_loseTriggers) 
         if (trigger.IsTrue || trigger.Update(me))
         {//Lost
             if (IsLocal(me))
                 trigger.DisplayMessage(false);
             Lost = true;
             return true;
         }
     return false;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:12,代码来源:MyMissionTriggers.cs

示例7: UpdateWin

 public bool UpdateWin(MyCharacter me)
 {
     foreach (var trigger in m_winTriggers)
         if (trigger.IsTrue || trigger.Update(me))
         { //Won!
             if (IsLocal(me))
                 trigger.DisplayMessage(true);
             Won = true;
             return true;
         }
     return false;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:12,代码来源:MyMissionTriggers.cs

示例8: Update

        /*public bool Update(MyFaction faction, MyCharacter me)
        {
            bool res = false;
            if (faction != null)
                res = Update(faction.FactionId, me);
            else
                res = Update(me.EntityId, me);

            return res;
        }*/
        /*public bool Update()
        {
            return false;
        }*/

        public bool Update(MyPlayer.PlayerId Id, MyCharacter me)
        {
            MyMissionTriggers mtrig;
            if (!MissionTriggers.TryGetValue(Id, out mtrig))
            {
                //Debug.Assert(false,"Bad ID for update in missionTriggers");
                return false;
            }
            mtrig.UpdateWin(me);

            mtrig.UpdateLose(me);//!!
            return false;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:28,代码来源:MySessionComponentMissionTriggers.cs

示例9: AddItems

        private void AddItems(MyCharacter character)
        {
            character.GetInventory(0).Clear();

            var ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(StartingWeaponId.SubtypeName);
            character.GetInventory(0).AddItems(1, ob);

            foreach (var weaponDef in HumanoidDefinition.InventoryItems)
            {
                ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(weaponDef.SubtypeName);
                character.GetInventory(0).AddItems(1, ob);
            }

            character.SwitchToWeapon(StartingWeaponId);
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:15,代码来源:MyHumanoidBot.cs

示例10:

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            // How to distinct between server sending message?
            // - it's response...always

            // This is request
            // 1) use - server call
            // -- on server: take control of entity
            // -- -- on success, use it, broadcast
            // -- -- on failure, don't use it, report back

            // Something like:
            // -- extension method IControllableEntity.RequestUse(actionEnum, user, handler)
            if(Cockpit is MyCockpit)
                (Cockpit as MyCockpit).RequestUse(actionEnum, user);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:16,代码来源:MyUseObjectCockpitDoor.cs

示例11: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user));
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:19,代码来源:MyUseObjectWardrobe.cs

示例12: MyGuiScreenWardrobe

        public MyGuiScreenWardrobe(MyCharacter user)
            : base(size: new Vector2(0.31f, 0.55f),
                   position: MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP),
                   backgroundColor: MyGuiConstants.SCREEN_BACKGROUND_COLOR,
                   backgroundTexture: MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.Texture)
        {
            EnabledBackgroundFade = false;

            m_user        = user;
            m_storedModel = m_user.ModelName;
            m_storedHSV   = m_user.ColorMask;

            m_selectedModel = GetDisplayName(m_user.ModelName);
            m_selectedHSV   = m_storedHSV;

            m_displayModels = new Dictionary<string, int>();
            m_models = new Dictionary<int, string>();

            int i = 0;
            foreach (var character in MyDefinitionManager.Static.Characters)
            {
                if (!character.UsableByPlayer) continue;

                var key = GetDisplayName(character.Name);
                m_displayModels[key] = i;
                m_models[i++] = character.Name;
            }

            RecreateControls(true);

            m_sliderHue.Value        = m_selectedHSV.X * 360f;
            m_sliderSaturation.Value = m_selectedHSV.Y * 100f;
            m_sliderValue.Value      = m_selectedHSV.Z * 100f;

            m_sliderHue.ValueChanged        += OnValueChange;
            m_sliderSaturation.ValueChanged += OnValueChange;
            m_sliderValue.ValueChanged      += OnValueChange;

            ChangeCamera();
            UpdateLabels();
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:41,代码来源:MyGuiScreenWardrobe.cs

示例13: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Door.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    Door.SetOpenRequest(!Door.Open, user.ControllerInfo.ControllingIdentityId);
                    break;

                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Door);
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:23,代码来源:MyUseObjectDoorTerminal.cs

示例14: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Block);
                    break;
                case UseActionEnum.OpenInventory:
                    if (Block as IMyInventoryOwner != null)
                        MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Block);
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:23,代码来源:MyUseObjectTerminal.cs

示例15: AddItems

        protected override void AddItems(MyCharacter character)
        {
            base.AddItems(character);

            var ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(StartingWeaponId.SubtypeName);
            if (character.WeaponTakesBuilderFromInventory(StartingWeaponId))
            {
                character.GetInventory(0).AddItems(1, ob);
            }

            // else // allowing the inventory items to be added
            {
                foreach (var weaponDef in HumanoidDefinition.InventoryItems)
                {
                    ob = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_PhysicalGunObject>(weaponDef.SubtypeName);
                    character.GetInventory(0).AddItems(1, ob);
                }
            }

            character.SwitchToWeapon(StartingWeaponId);

            {
                MyDefinitionId weaponDefinitionId;
                weaponDefinitionId = new MyDefinitionId(typeof(MyObjectBuilder_WeaponDefinition), StartingWeaponId.SubtypeName);

                MyWeaponDefinition weaponDefinition;

                if (MyDefinitionManager.Static.TryGetWeaponDefinition(weaponDefinitionId, out weaponDefinition)) //GetWeaponDefinition(StartingWeaponId);
                {
                    if (weaponDefinition.HasAmmoMagazines())
                    {
                        var ammo = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_AmmoMagazine>(weaponDefinition.AmmoMagazinesId[0].SubtypeName);
                        character.GetInventory(0).AddItems(3, ammo);
                    }
                }
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:37,代码来源:MyHumanoidBot.cs


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