コード例 #1
0
        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            Debug.Assert(m_radiusSlider.GetValue() > 30 || m_bots.Count <= 1, "Spawnpoint radius is too small, you will probably get failed spawn attempts!");
            
            if (!HasEntity())
            {
                MyMwcObjectBuilder_SpawnPoint builder = MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.SpawnPoint, null) as MyMwcObjectBuilder_SpawnPoint;
                builder.BoundingRadius = m_radiusSlider.GetValue();

                float cameraDistance = builder.BoundingRadius / (float)Math.Sin(MathHelper.ToRadians(MyCamera.FieldOfViewAngle / 2)) * 1.2f;

                m_spawnPoint = MyEntities.CreateFromObjectBuilderAndAdd(null, builder, Matrix.CreateWorld(MyCamera.Position + cameraDistance * MyCamera.ForwardVector, Vector3.Forward, Vector3.Up)) as MySpawnPoint;
            }

            MyMwcObjectBuilder_FactionEnum shipFaction = (MyMwcObjectBuilder_FactionEnum)
                Enum.ToObject(typeof(MyMwcObjectBuilder_FactionEnum), m_selectShipFactionCombobox.GetSelectedKey()); 

            List<BotTemplate> templates = new List<BotTemplate>();
            foreach (int key in m_bots.Keys)
            {
                BotTemplate btmp;
                m_bots.TryGetValue(key, out btmp);
                btmp.m_builder.Faction = shipFaction;
                templates.Add(btmp);
            }

            m_spawnPoint.SpawnInGroups = m_spawnInGroupsCheckbox.Checked;
            m_spawnPoint.LeftToSpawn = GetSpawnCount();
            m_spawnPoint.MaxSpawnCount = m_spawnPoint.LeftToSpawn;
            m_spawnPoint.FirstSpawnTimer = m_firstSpawnTimeSlider.GetValue();
            m_spawnPoint.RespawnTimer = m_respawnTimeSlider.GetValue();

            m_spawnPoint.Faction = shipFaction;
            m_spawnPoint.SetWayPointPath(m_waypointPathCombobox.GetSelectedValue().ToString());
            m_spawnPoint.PatrolMode = (MyPatrolMode)m_patrolModeCombobox.GetSelectedKey();
            m_spawnPoint.ApplyBotTemplates(templates);

            m_spawnPoint.BoundingSphereRadius = m_radiusSlider.GetValue();
            if (m_activeCheckbox.Checked && !m_spawnPoint.IsActive())
            {
                m_spawnPoint.Activate();
            }
            else if (!m_activeCheckbox.Checked && m_spawnPoint.IsActive())
            {
                m_spawnPoint.Deactivate();
            }
            
            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
        }
コード例 #2
0
 void spawnPoint_OnActivatedChanged(MySpawnPoint obj)
 {
     UpdateCurrentBotCount();
 }
コード例 #3
0
 public MyGuiScreenEditorSpawnPoint(MySpawnPoint spawnPoint)
     : base(spawnPoint, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.SpawnPoint)
 {
     m_spawnPoint = spawnPoint;
     Init();
 }
コード例 #4
0
 private void MyScriptWrapperOnSpawnpointBotsKilled(MySpawnPoint spawnPoint)
 {
     if (spawnPoint.EntityId.Value.NumericValue == (uint)EntityID.SpawnPoint1)
     {
         MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnPoint2);
     }
 }
コード例 #5
0
        private void Script_SpawnpointBotsKilled(MySpawnPoint spawnPoint)
        {
            if (spawnPoint.EntityId.Value.NumericValue == (uint)EntityID.SpawnPointEscape)
            {
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.BARTHS_MOON_TRANSMITTER_2800);
            }

            if (spawnPoint.EntityId.Value.NumericValue == (uint)EntityID.SpawnPoint4)
            {
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.BARTHS_MOON_TRANSMITTER_3000);
            }
        }
コード例 #6
0
        public void SpawnBot(MySpawnPoint spawnPoint, MySmallShipBot bot, int botsIdx, Vector3 spawnPosition)
        {
            MyEventSpawnBot msg = new MyEventSpawnBot();
            msg.SpawnPointId = (uint)spawnPoint.EntityId.Value.NumericValue;
            msg.DesiredBotId = (uint)bot.EntityId.Value.NumericValue;
            msg.BotsIdx = botsIdx;
            msg.SpawnPosition = spawnPosition;

            LogDevelop(string.Format("SpawnBot(SpawnPointId = {0}, DesiredBotId = {1}, BotsIdx = {2})", msg.SpawnPointId, msg.DesiredBotId, msg.BotsIdx));

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);
        }
コード例 #7
0
        void Travel_SpawnpointBotsKilled(MySpawnPoint spawnPoint)
        {
            if (spawnPoint == MyScriptWrapper.TryGetEntity((uint)EntityID.AMBUSH_1_SPAWNPOINT_B))
            {
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.PIRATE_BASE_0300);
            }

            if (spawnPoint == MyScriptWrapper.TryGetEntity((uint)EntityID.AMBUSH_6_SPAWNPOINT_B))
            {
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.PIRATE_BASE_0500);
            }
        }
コード例 #8
0
        void OnSpawnpointBotsKilled(MySpawnPoint spawnpoint)
        {
            uint id = MyScriptWrapper.GetEntityId(spawnpoint);
            switch (id)
            {
                // Ambush waves
                case (uint)EntityID.AmbushSpawnpoint0:
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.AmbushSpawnpoint1);
                    break;
                case (uint)EntityID.AmbushSpawnpoint1:
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.AmbushSpawnpoint2);
                    break;

                // Fly Back waves
                case (uint)EntityID.FlyBackSpawnpoint0:
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.FlyBackSpawnpoint1);
                    break;
                case (uint)EntityID.FlyBackSpawnpoint1:
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.FlyBackSpawnpoint2);
                    break;
            }
        }