Example #1
0
        private bool SetupFilter()
        {
            bool result = true;
            ShipObstacleDistance minDist = null;

            foreach (GenericShip ship in Roster.AllShips.Values)
            {
                ShipObstacleDistance dist = new ShipObstacleDistance(ship, ChosenObstacle);
                if (minDist == null || dist.DistanceReal < minDist.DistanceReal)
                {
                    minDist = dist;
                }
            }

            if (minDist.Range <= 2)
            {
                result = false;
                if (minDist.DistanceReal < MoveObstacleMidgameSubPhase.DistanceFromEdge)
                {
                    MovementTemplates.ShowRangeRulerR2(minDist.NearestPointObstacle, minDist.NearestPointShip);
                }
            }

            return(result);
        }
Example #2
0
        private bool IsDiceModificationAvailable()
        {
            foreach (var obstacle in Obstacles.ObstaclesManager.GetPlacedObstacles())
            {
                ShipObstacleDistance obstacleDistance = new ShipObstacleDistance(HostShip, obstacle);
                if (obstacleDistance.Range < 2)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #3
0
        private void FinallyDetonateBomb()
        {
            BombsManager.UnregisterBomb(BombsManager.CurrentBombObject);
            CurrentBombObjects.Remove(BombsManager.CurrentBombObject);

            if (ChosenObstacle != null)
            {
                foreach (GenericShip ship in Roster.AllShips.Values)
                {
                    ShipObstacleDistance shipOstacleDist = new ShipObstacleDistance(ship, ChosenObstacle);
                    if (shipOstacleDist.Range < 2)
                    {
                        RegisterDetonationTriggerForShip(ship);
                    }
                }
            }

            PlayDetonationAnimSound(BombsManager.CurrentBombObject, DetonateObstacle);
        }
Example #4
0
        private bool IsNearObstacle()
        {
            if (HostShip.IsLandedOnObstacle)
            {
                Messages.ShowInfo(HostUpgrade.Name + ": Action is treated as white");
                return(true);
            }

            foreach (GenericObstacle obstacle in ObstaclesManager.GetPlacedObstacles())
            {
                ShipObstacleDistance shipObstacleDist = new ShipObstacleDistance(HostShip, obstacle);
                if (shipObstacleDist.Range < 2)
                {
                    Messages.ShowInfo(HostUpgrade.Name + ": Action is treated as white");
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        // ITargetLockable

        public int GetRangeToShip(GenericShip fromShip)
        {
            ShipObstacleDistance dist = new ShipObstacleDistance(fromShip, this);

            return(dist.Range);
        }