Exemple #1
0
        public void AddCarryOverInfo(int systemId, int fleetId, int shipId, Matrix endShipTransform)
        {
            MCSystemInfo mcSystemInfo1 = this.Systems.FirstOrDefault <MCSystemInfo>((Func <MCSystemInfo, bool>)(x => x.SystemID == systemId));

            if (mcSystemInfo1 != null)
            {
                MCFleetInfo mcFleetInfo1 = mcSystemInfo1.Fleets.FirstOrDefault <MCFleetInfo>((Func <MCFleetInfo, bool>)(x => x.FleetID == fleetId));
                if (mcFleetInfo1 != null)
                {
                    MCShipInfo mcShipInfo = mcFleetInfo1.Ships.FirstOrDefault <MCShipInfo>((Func <MCShipInfo, bool>)(x => x.ShipID == shipId));
                    if (mcShipInfo != null)
                    {
                        mcShipInfo.PreviousTransform = endShipTransform;
                    }
                    else
                    {
                        mcFleetInfo1.Ships.Add(new MCShipInfo()
                        {
                            ShipID            = shipId,
                            PreviousTransform = endShipTransform
                        });
                    }
                }
                else
                {
                    MCShipInfo mcShipInfo = new MCShipInfo()
                    {
                        ShipID            = shipId,
                        PreviousTransform = endShipTransform
                    };
                    MCFleetInfo mcFleetInfo2 = new MCFleetInfo()
                    {
                        FleetID = fleetId
                    };
                    mcFleetInfo2.Ships.Add(mcShipInfo);
                    mcSystemInfo1.Fleets.Add(mcFleetInfo2);
                }
            }
            else
            {
                MCShipInfo mcShipInfo = new MCShipInfo()
                {
                    ShipID            = shipId,
                    PreviousTransform = endShipTransform
                };
                MCFleetInfo mcFleetInfo = new MCFleetInfo()
                {
                    FleetID = fleetId
                };
                mcFleetInfo.Ships.Add(mcShipInfo);
                MCSystemInfo mcSystemInfo2 = new MCSystemInfo()
                {
                    SystemID = systemId
                };
                mcSystemInfo2.Fleets.Add(mcFleetInfo);
                this.Systems.Add(mcSystemInfo2);
            }
        }
Exemple #2
0
        public Matrix?GetPreviousShipTransform(int systemId, int fleetId, int shipId)
        {
            MCSystemInfo mcSystemInfo = this.Systems.FirstOrDefault <MCSystemInfo>((Func <MCSystemInfo, bool>)(x => x.SystemID == systemId));

            if (mcSystemInfo != null)
            {
                MCFleetInfo mcFleetInfo = mcSystemInfo.Fleets.FirstOrDefault <MCFleetInfo>((Func <MCFleetInfo, bool>)(x => x.FleetID == fleetId));
                if (mcFleetInfo != null)
                {
                    MCShipInfo mcShipInfo = mcFleetInfo.Ships.FirstOrDefault <MCShipInfo>((Func <MCShipInfo, bool>)(x => x.ShipID == shipId));
                    if (mcShipInfo != null)
                    {
                        return(new Matrix?(mcShipInfo.PreviousTransform));
                    }
                }
            }
            return(new Matrix?());
        }