當前位置: 首頁>>代碼示例>>C#>>正文


C# MyEntity.SetName方法代碼示例

本文整理匯總了C#中MinerWars.AppCode.Game.Entities.MyEntity.SetName方法的典型用法代碼示例。如果您正苦於以下問題:C# MyEntity.SetName方法的具體用法?C# MyEntity.SetName怎麽用?C# MyEntity.SetName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MinerWars.AppCode.Game.Entities.MyEntity的用法示例。


在下文中一共展示了MyEntity.SetName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnSpawnpointBotSpawned

        void OnSpawnpointBotSpawned(MyEntity spawnpoint, MyEntity spawnedBot)
        {
            foreach (var sp in m_firstWave)
            {
                if (spawnpoint == MyScriptWrapper.GetEntity(sp))
                {
                    MyScriptWrapper.SetSleepDistance(spawnedBot, 3000);
                }
            }

            foreach (var item in new List<uint> { (uint)EntityID.SP4_1, (uint)EntityID.SP4_2 })
            {
                if (spawnpoint.EntityId.Value.NumericValue == item)
                {
                    MyScriptWrapper.StopFollow(spawnedBot);
                    if (m_momoBoss != null)
                    {
                        MyScriptWrapper.SetEntityDestructible(spawnedBot, false);
                        MyScriptWrapper.Follow(m_momoBoss, spawnedBot);
                        MyScriptWrapper.SetSleepDistance(spawnedBot, 3000);
                    }
                    else
                    {
                        Debug.Assert(true, "Boss entity is null. Cannot identify leader");
                    }
                }
            }

            if (spawnpoint == MyScriptWrapper.GetEntity((uint)EntityID.MomoZappaSP))
            {
                spawnedBot.SetName("Momo");
                spawnedBot.DisplayName = MyTexts.MomoZappa;
                m_momoBoss = (MySmallShipBot) spawnedBot;
                m_objective07SpeakWithMomo.BotToTalkId = MyScriptWrapper.GetEntityId(m_momoBoss);
                MyScriptWrapper.SetEntityDestructible(m_momoBoss, false);
                m_momoBoss.LookTarget = MySession.PlayerShip;
                m_momoBoss.Health = m_momoBoss.MaxHealth = 1000;
                MyScriptWrapper.SetSleepDistance(spawnedBot, 3000);
                MyScriptWrapper.ActivateSpawnPoint((uint) EntityID.SP4_1);
                MyScriptWrapper.ActivateSpawnPoint((uint) EntityID.SP4_2);
            }

            if (spawnpoint == MyScriptWrapper.GetEntity((uint)EntityID.BR_SP_Boss))
            {
                spawnedBot.DisplayName = MyTexts.GangsterBoss;
                m_blackRavenBoss = (MySmallShipBot)spawnedBot;
                MyScriptWrapper.SetEntityDestructible(m_blackRavenBoss, false);
                MyScriptWrapper.ChangeFaction(m_blackRavenBoss, MyMwcObjectBuilder_FactionEnum.Traders);
                m_blackRavenBoss.LookTarget = MySession.PlayerShip;
                m_blackRavenBoss.Health = m_blackRavenBoss.MaxHealth = 500;
                MyScriptWrapper.SetSleepDistance(spawnedBot, 5000);

                m_blackRavenBoss.OnDie += OnGangsterBossDied;

                foreach (var item in new List<uint>
                    {
                        (uint) EntityID.BR_SP_1,
                        (uint) EntityID.BR_SP_2,
                        (uint) EntityID.BR_SP_3,
                        (uint) EntityID.BR_SP_4,
                        (uint) EntityID.BR_SP_Boss
                    })
                {
                    MyScriptWrapper.ActivateSpawnPoint(item);
                }
            }

            foreach (var item in m_spawns)
            {
                if (spawnpoint == MyScriptWrapper.GetEntity(item) && spawnedBot != m_blackRavenBoss)
                {
                    MyScriptWrapper.SetSleepDistance(spawnedBot, 5000);
                    if (m_blackRavenBoss != null && !m_blackRavenBoss.Closed)
                    {
                        if (ActiveObjectives.Contains(m_objective12BrFight))
                        {
                            MyScriptWrapper.SetEntityDestructible(spawnedBot, true);
                            MyScriptWrapper.ChangeFaction(spawnedBot, MyMwcObjectBuilder_FactionEnum.Slavers);
                        }
                        else
                        {
                            MyScriptWrapper.SetEntityDestructible(spawnedBot, false);
                            MyScriptWrapper.ChangeFaction(spawnedBot, MyMwcObjectBuilder_FactionEnum.Traders);
                        }
                        MyScriptWrapper.Follow(m_blackRavenBoss, spawnedBot);
                    }
                    else
                    {
                        MyScriptWrapper.SetEntityDestructible(spawnedBot, true);
                        MyScriptWrapper.ChangeFaction(spawnedBot, MyMwcObjectBuilder_FactionEnum.Slavers);
                        ((MySmallShipBot)spawnedBot).Attack(MySession.PlayerShip);
                    }
                }
            }
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:95,代碼來源:MyJunkyardConvinceMission.cs


注:本文中的MinerWars.AppCode.Game.Entities.MyEntity.SetName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。