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

            tempCells.Clear();
            tempCells2.Clear();
            foreach (var cell in GetLaunchCells())
            {
                tempCells2.Add(cell);
                if (IsCellBlocked(cell, out _))
                {
                    tempCells.Add(cell);
                }
            }
            if (tempCells.Count > 0)
            {
                GenDraw.DrawFieldEdges(tempCells2, Color.white);
                GenDraw.DrawFieldEdges(tempCells, Color.red);
            }

            if (!drawAffectedCells)
            {
                return;
            }

            float radius;

            if (CECompat.IsCEActive)
            {
                radius = CECompat.GetExplosionRadius(CurrentShellDef);
            }
            else
            {
                radius = CurrentShellDef?.projectileWhenLoaded?.projectile?.explosionRadius ?? -1;
            }

            if (firstPosition == null || secondPosition == null)
            {
                if (firstPosition != null && LoadedShellCount == 1)
                {
                    GenAirstrike.DrawStrikePreview(firstPosition.Value, firstPosition.Value, Map, 1, radius);
                }
                return;
            }

            GenAirstrike.DrawStrikePreview(firstPosition.Value, secondPosition.Value, Map, LoadedShellCount, radius);
        }
コード例 #2
0
        public void DoStrike()
        {
            bool isAntimatter = CurrentShellDef == ThingDefOf.Shell_AntigrainWarhead;

            if (isAntimatter)
            {
                GenericEventTracker.Fire(AchievementEvent.DroneAntimatter);

                if (LoadedShellCount >= MaxLoadedShellCount)
                {
                    GenericEventTracker.Fire(AchievementEvent.DroneAntimatterFull);
                }
            }

            GenAirstrike.DoStrike(this, CECompat.IsCEActive ? CECompat.GetProjectile(CurrentShellDef) : CurrentShellDef.projectileWhenLoaded, firstPosition.Value, secondPosition.Value, LoadedShellCount, 200, RFDefOf.RF_Sound_Drone);
            ClearLoadedShells();

            isFlying    = true;
            ticksFlying = 0;

            SoundInfo info = SoundInfo.InMap(this);

            RFDefOf.RF_Sound_DroneLaunch.PlayOneShot(info);
        }