Beispiel #1
0
        private void InitializeShipBaseArc()
        {
            switch (ShipBaseArcsType)
            {
            case BaseArcsType.ArcDefault:
                ArcInfo = new GenericArc(this);
                break;

            case BaseArcsType.ArcRear:
                ArcInfo = new ArcRear(this);
                break;

            case BaseArcsType.Arc180:
                ArcInfo = new Arc180(this);
                break;

            case BaseArcsType.Arc360:
                ArcInfo = new Arc360(this);
                break;

            case BaseArcsType.ArcMobile:
                ArcInfo = new ArcMobile(this);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void GetShipsInAllArcDirections()
        {
            ArcMobile temporaryArc = new ArcMobile(Selection.ThisShip.ShipBase);

            Selection.ThisShip.ArcInfo.Arcs.Add(temporaryArc);

            EnemiesInArcHolder = new Dictionary <ArcFacing, List <GenericShip> >();

            foreach (var arc in ArcFacings)
            {
                EnemiesInArcHolder.Add(arc, new List <GenericShip>());

                foreach (GenericShip enemyShip in Roster.GetPlayer(Roster.AnotherPlayer(Selection.ThisShip.Owner.PlayerNo)).Ships.Values)
                {
                    temporaryArc.Facing = arc;

                    if (Selection.ThisShip.ShipsBumped.Contains(enemyShip))
                    {
                        continue;
                    }
                    if (Selection.ThisShip.ShipBaseArcsType == BaseArcsType.ArcMobileDual && (arc == ArcFacing.Right || arc == ArcFacing.Rear))
                    {
                        continue;
                    }

                    ShotInfoArc arcShotInfo = new ShotInfoArc(Selection.ThisShip, enemyShip, temporaryArc);
                    if (arcShotInfo.InArc && arcShotInfo.Range < 4)
                    {
                        EnemiesInArcHolder[arc].Add(enemyShip);
                    }
                    else if (Selection.ThisShip.ShipBaseArcsType == BaseArcsType.ArcMobile) // With primary firing arc
                    {
                        ShotInfoArc arcPrimaryShotInfo = new ShotInfoArc(Selection.ThisShip, enemyShip, Selection.ThisShip.ArcInfo.GetArc <ArcPrimary>());
                        if (arcPrimaryShotInfo.InArc && arcPrimaryShotInfo.Range < 4)
                        {
                            EnemiesInArcHolder[arc].Add(enemyShip);
                        }
                    }
                    else if (Selection.ThisShip.ShipBaseArcsType == BaseArcsType.ArcMobileDual)
                    {
                        temporaryArc.Facing = DualPointerArcs[arc];
                        ShotInfoArc secondArcShotInfo = new ShotInfoArc(Selection.ThisShip, enemyShip, temporaryArc);
                        if (secondArcShotInfo.InArc && secondArcShotInfo.Range < 4)
                        {
                            EnemiesInArcHolder[arc].Add(enemyShip);
                        }
                    }
                }
            }

            Selection.ThisShip.ArcInfo.Arcs.Remove(temporaryArc);
        }