コード例 #1
0
        void detector_OnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            MyDummyPoint    dummy     = (MyDummyPoint)sender.Parent;
            uint            scannerId = (uint)dummy.Tag;
            MyPrefabScanner scanner   = (MyPrefabScanner)MyScriptWrapper.GetEntity(scannerId);

            scanner.Enabled = false;
        }
コード例 #2
0
 private void ScannerOnOnEntityScanned(MyPrefabScanner sender, MyEntity scannedEntity)
 {
     if (scannedEntity == MySession.PlayerShip && m_scanners.Contains(sender))
     {
         scannedEntity.DoDamage(0, 1000000, 0, MyDamageType.Unknown, MyAmmoType.Unknown, null);
         ((MyPrefabContainer)sender.Parent).AlarmOn = true;
     }
 }
コード例 #3
0
 public MyGuiScreenEditorScanner(MyPrefabScanner scanner)
     : base(scanner, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditScanner)
 {
     m_originalSize          = Scanner.Size;
     m_originalColor         = Scanner.Color;
     m_originalOn            = Scanner.Enabled;
     m_originalScanningSpeed = Scanner.ScanningSpeed;
     Init();
     Scanner.Enabled = false;
 }
コード例 #4
0
        void detector_OnEntityLeave(MyEntityDetector sender, MyEntity entity)
        {
            //MySpawnPoint spawnPoint = (MySpawnPoint)MyScriptWrapper.GetEntity((uint)EntityID.PatrolSpawnPoint);

            MyDummyPoint dummy = (MyDummyPoint)sender.Parent;


            if (MyFactions.GetFactionsRelation(dummy, entity) == MyFactionRelationEnum.Friend)
            {
            }


            uint            scannerId = (uint)dummy.Tag;
            MyPrefabScanner scanner   = (MyPrefabScanner)MyScriptWrapper.GetEntity(scannerId);

            scanner.Enabled = true;
        }
コード例 #5
0
        public override void Load()
        {
            base.Load();
            var entities = MyEntities.GetEntities();

            var detectorsIds = new[] { EntityID.Detector0, EntityID.Detector1, EntityID.Detector2 };
            var scannerIds   = new[] { EntityID.Scanner0, EntityID.Scanner1, EntityID.Scanner2 };

            for (int i = 0; i < detectorsIds.Length; i++)
            {
                MyDummyPoint    dummy   = (MyDummyPoint)MyScriptWrapper.GetEntity((uint)detectorsIds[i]);
                MyPrefabScanner scanner = (MyPrefabScanner)MyScriptWrapper.GetEntity((uint)scannerIds[i]);
                dummy.Tag = scanner.EntityId.Value.NumericValue;

                var detector = dummy.GetDetector();
                detector.OnEntityEnter += new OnEntityEnter(detector_OnEntityEnter);
                detector.OnEntityLeave += new OnEntityLeave(detector_OnEntityLeave);
                detector.On();
            }
        }
コード例 #6
0
        /// <summary>
        /// CreatePrefab
        /// </summary>
        /// <param name="hudLabelText"></param>
        /// <param name="objBuilder"></param>
        /// <returns></returns>
        public MyPrefabBase CreatePrefab(string hudLabelText, MyPrefabContainer prefabContainer, MyMwcObjectBuilder_PrefabBase prefabBuilder)
        {
            Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyPrefabFactory.CreatePrefab");

            MyPrefabConfiguration config   = MyPrefabConstants.GetPrefabConfiguration(prefabBuilder.GetObjectBuilderType(), prefabBuilder.GetObjectBuilderId().Value);
            Vector3 relativePosition       = MyPrefabContainer.GetRelativePositionInAbsoluteCoords(prefabBuilder.PositionInContainer);
            Matrix  prefabLocalOrientation = Matrix.CreateFromYawPitchRoll(prefabBuilder.AnglesInContainer.X, prefabBuilder.AnglesInContainer.Y, prefabBuilder.AnglesInContainer.Z);

            MyPrefabBase prefab = null;

            if (config is MyPrefabConfigurationKinematic)
            {
                prefab = new MyPrefabKinematic(prefabContainer);
            }
            else if (config is MyPrefabConfigurationLight)
            {
                prefab = new MyPrefabLight(prefabContainer);
            }
            else if (config is MyPrefabConfigurationLargeWeapon)
            {
                prefab = new MyPrefabLargeWeapon(prefabContainer);
            }
            else if (config is MyPrefabConfigurationSound)
            {
                prefab = new MyPrefabSound(prefabContainer);
            }
            else if (config is MyPrefabConfigurationParticles)
            {
                prefab = new MyPrefabParticles(prefabContainer);
            }
            else if (config is MyPrefabConfigurationLargeShip)
            {
                prefab = new MyPrefabLargeShip(prefabContainer);
            }
            else if (config is MyPrefabConfigurationHangar)
            {
                prefab = new MyPrefabHangar(prefabContainer);
            }
            else if (config is MyPrefabConfigurationFoundationFactory)
            {
                prefab = new MyPrefabFoundationFactory(prefabContainer);
            }
            else if (config is MyPrefabConfigurationSecurityControlHUB)
            {
                prefab = new MyPrefabSecurityControlHUB(prefabContainer);
            }
            else if (config is MyPrefabConfigurationBankNode)
            {
                prefab = new MyPrefabBankNode(prefabContainer);
            }
            else if (config is MyPrefabConfigurationGenerator)
            {
                prefab = new MyPrefabGenerator(prefabContainer);
            }
            else if (config is MyPrefabConfigurationScanner)
            {
                prefab = new MyPrefabScanner(prefabContainer);
            }
            else if (config is MyPrefabConfigurationCamera)
            {
                prefab = new MyPrefabCamera(prefabContainer);
            }
            else if (config is MyPrefabConfigurationAlarm)
            {
                prefab = new MyPrefabAlarm(prefabContainer);
            }
            else
            {
                prefab = new MyPrefab(prefabContainer);
                //prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);
            }
            prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);

            Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            return(prefab);
        }