コード例 #1
0
        public void AddMissileTurret(IMyBlockGroup group)
        {
            try
            {
                var turretGroup = new MissileTurretGroup(GTSUtils, group, ingameTime, deadzoneProvider, azimuthTag, elevationTag);
                turretGroup.TargetDirection(ref Vector3D.Zero);
                turretGroup.defaultDir = control.WorldMatrix.Forward;

                if (turretGroup.CheckGroupStatus() != TurretGroupUtils.TurretGroupStatus.MajorDMG)
                {
                    missileTurretGroups.Add(turretGroup);
                }
            }
            catch
            {
                statusWriter.AddUninitializable(1);
            }
        }
コード例 #2
0
        public void AddMissileTurret(IMyMotorStator sourceRotor)
        {
            try
            {
                rotors.Clear();
                cache.Clear();
                prevTop.Clear();
                currentTop.Clear();

                rotors.Add(sourceRotor);
                prevTop.AddRange(rotors);

                while (prevTop.Count > 0)
                {
                    foreach (var rotor in prevTop)
                    {
                        cache.Clear();
                        rotor.TopGrid?.GetCubesOfType(GridTerminalSystem, cache);
                        currentTop.AddRange(cache);
                    }

                    rotors.AddRange(currentTop);

                    prevTop.Clear();
                    prevTop.AddRange(currentTop);
                    currentTop.Clear();
                }

                var turretGroup = new MissileTurretGroup(GTSUtils, rotors, ingameTime, deadzoneProvider, azimuthTag, elevationTag);
                turretGroup.TargetDirection(ref Vector3D.Zero);
                turretGroup.defaultDir = control.WorldMatrix.Forward;

                if (turretGroup.CheckGroupStatus() != TurretGroupUtils.TurretGroupStatus.MajorDMG)
                {
                    missileTurretGroups.Add(turretGroup);
                }
            }
            catch
            {
                statusWriter.AddUninitializable(1);
            }
        }