Esempio n. 1
0
        /// <summary>
        /// Creates a map unit
        /// </summary>
        /// <param name="map"></param>
        /// <param name="unit"></param>
        /// <param name="movementOffset"></param>
        internal MapUnit(Map map, Unit unit, Vector movementOffset)
        {
            Map = map;

            Kind           = unit.Kind;
            RadiusInternal = unit.Radius;
            Name           = unit.Name;

            mobility   = unit.Mobility;
            isOrbiting = unit.IsOrbiting;
            isMasking  = unit.IsMasking;
            isSolid    = unit.IsSolid;

            gravity = unit.Gravity;

            PositionInternal = unit.Position;
            MovementInternal = unit.Movement + movementOffset;

            if (isOrbiting)
            {
                OrbitingCenter = unit.OrbitingCenter;

                orbitingList = new List <UnitOrbitingState>();

                foreach (var orbitingState in unit.OrbitingList)
                {
                    orbitingList.Add(new UnitOrbitingState(orbitingState));
                }
            }

            AgeInternal = 0;
        }
        ///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + PaintScheme.GetHashCode();
                hash = (hash * 29) + Mobility.GetHashCode();
                hash = (hash * 29) + Mission.GetHashCode();
                hash = (hash * 29) + Damage.GetHashCode();
                hash = (hash * 29) + Smoke.GetHashCode();
                hash = (hash * 29) + TrailingEffects.GetHashCode();
                hash = (hash * 29) + Lights.GetHashCode();
                hash = (hash * 29) + Flaming.GetHashCode();
                hash = (hash * 29) + Antenna.GetHashCode();
                hash = (hash * 29) + CamouflageType.GetHashCode();
                hash = (hash * 29) + Concealed.GetHashCode();
                hash = (hash * 29) + FrozenStatus.GetHashCode();
                hash = (hash * 29) + PowerPlantStatus.GetHashCode();
                hash = (hash * 29) + State.GetHashCode();
                hash = (hash * 29) + Tent.GetHashCode();
                hash = (hash * 29) + BlackoutLights.GetHashCode();
                hash = (hash * 29) + InteriorLights.GetHashCode();
            }

            return(hash);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor to clone a map unit
        /// </summary>
        /// <param name="mapUnit"></param>
        protected MapUnit(MapUnit mapUnit)
        {
            Map = mapUnit.Map;

            Kind           = mapUnit.Kind;
            RadiusInternal = mapUnit.Radius;
            Name           = mapUnit.Name;

            mobility   = mapUnit.Mobility;
            isOrbiting = mapUnit.IsOrbiting;
            isMasking  = mapUnit.IsMasking;
            isSolid    = mapUnit.IsSolid;

            gravity = mapUnit.gravity;

            PositionInternal = new Vector(mapUnit.PositionInternal);
            MovementInternal = new Vector(mapUnit.MovementInternal);

            if (isOrbiting)
            {
                OrbitingCenter = mapUnit.OrbitingCenter;

                orbitingList = new List <UnitOrbitingState>();

                foreach (var orbitingState in mapUnit.orbitingList)
                {
                    orbitingList.Add(new UnitOrbitingState(orbitingState));
                }
            }

            AgeInternal = 0;
        }
Esempio n. 4
0
 private void WriteGenerationFile(float totalProduction, float totalAttraction)
 {
     if (!string.IsNullOrEmpty(GenerationOutputFileName))
     {
         bool first = !File.Exists(GenerationOutputFileName);
         // make sure the directory exists
         var dir = Path.GetDirectoryName(GenerationOutputFileName);
         if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         // if the file name exists try to write to it, appending
         using (StreamWriter writer = new StreamWriter(GenerationOutputFileName, true))
         {
             if (first)
             {
                 writer.WriteLine("Age,Employment,Occupation,Mobility,Production,Attraction,WAH");
             }
             writer.Write(AgeCategoryRange.ToString());
             writer.Write(',');
             writer.Write(EmploymentStatusCategory.ToString());
             writer.Write(',');
             writer.Write(OccupationCategory.ToString());
             writer.Write(',');
             writer.Write(Mobility.ToString());
             writer.Write(',');
             writer.Write(totalProduction);
             writer.Write(',');
             writer.Write(totalAttraction);
             writer.Write(',');
             writer.WriteLine(WorkAtHomeTotal);
         }
     }
 }
Esempio n. 5
0
        //构造使用PS业务的用户
        public static User CreateUser_PS()
        {
            Mobility mobility = new Mobility("mobility", 30);
            int Priority = 1;
            #region 业务参数
            UnionPsService unionPsService = new UnionPsService();
            Dictionary<NetWorkType, Service> PSServiceDic = new Dictionary<NetWorkType, Service>();
            UMTSPsService umtsPsService = new UMTSPsService();
            umtsPsService.UmtsR99Bearer = new UMTSR99Bearer();
            PSServiceDic.Add(NetWorkType.UMTS, umtsPsService);
            unionPsService.PSServiceDic = PSServiceDic;
            #endregion

            #region 终端参数
            Terminal terminal = new Terminal();
            List<NetworkTerminal> NetterminalList = new List<NetworkTerminal>();
            UMTSTerminal tempTerminal = new UMTSTerminal();
            tempTerminal.NoiseFigure = 2;
            tempTerminal.NetType = NetWorkType.UMTS;
            NetterminalList.Add(tempTerminal);
            terminal.NetTerminalList = NetterminalList;
            User user = new User(mobility, unionPsService, terminal, LinkType.Uplink, Priority);
            return user;
            #endregion
        }
Esempio n. 6
0
        private void CalculateMobility()
        {
            Mobility allPercentage = new Mobility();
            Mobility allFlat       = new Mobility();

            foreach (MobilityModifier mm in modifiers.mobility)
            {
                if (mm.type == ModifierType.Percentage)
                {
                    if (mm.skillAssociation == "")
                    {
                        allPercentage += mm.bonus;
                    }
                    else
                    {
                        allPercentage += mm.bonus * GameManager.gameData.skillsData.GetSkillIndex(mm.skillAssociation);
                    }
                }
                else
                {
                    if (mm.skillAssociation == "")
                    {
                        allFlat += mm.bonus;
                    }
                    else
                    {
                        allFlat += mm.bonus * GameManager.gameData.skillsData.GetSkillIndex(mm.skillAssociation);
                    }
                }
            }

            _modifiedStats.mobility  = _baseStats.mobility + (_baseStats.mobility * allPercentage);
            _modifiedStats.mobility += allFlat;
        }
Esempio n. 7
0
        public override void DefaultInitialize()
        {
            Vitality = Add(new VitalityFocus());
            Tenacity = Add(new TenacityFocus());
            Mobility = Add(new MobilityFocus());
            Utility  = Add(new UtilityFocus());
            Ferocity = Add(new FerocityFocus());
            Capacity = Add(new CapacityFocus());

            Vitality.RegisterEnemies(new Focus[] { Mobility, Ferocity });
            Vitality.RegisterNemeses(Utility);

            Tenacity.RegisterEnemies(new Focus[] { Utility, Capacity });
            Tenacity.RegisterNemeses(Ferocity);

            Mobility.RegisterEnemies(new Focus[] { Ferocity, Vitality });
            Mobility.RegisterNemeses(Capacity);

            Utility.RegisterEnemies(new Focus[] { Capacity, Tenacity });
            Utility.RegisterNemeses(Vitality);

            Ferocity.RegisterEnemies(new Focus[] { Vitality, Mobility });
            Ferocity.RegisterNemeses(Tenacity);

            Capacity.RegisterEnemies(new Focus[] { Tenacity, Utility });
            Capacity.RegisterNemeses(Mobility);

            ForAllItems(f => f.ManagerEndInitialization());
            base.DefaultInitialize();
        }
 public StaticMeshComponent(string name, ResourceReference archetype, ResourceReference staticMesh, int staticMeshImportVersion, Vector3 relativeLocation, Rotator relativeRotation, Vector3 relativeScale3D, Node[] children, ResourceReference[] overrideMaterials, Mobility mobility)
     : base(name, archetype, relativeLocation, relativeScale3D, relativeRotation, children)
 {
     StaticMesh = staticMesh;
     StaticMeshImportVersion = staticMeshImportVersion;
     OverrideMaterials       = overrideMaterials;
     Mobility = mobility;
 }
Esempio n. 9
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Mobility.GetHashCode();
         result = (result * 397) ^ Units.GetHashCode();
         return(result);
     }
 }
Esempio n. 10
0
 public bool CheckMobilityPropertyAndCommitData(Mobility newMobility, string oldName, string change, ref string info)
 {
     if (!this.IsMobilityPropertyValid(newMobility, oldName, change, ref info))
     {
         return false;
     }
     this.CommitData(newMobility, oldName, change);
     return true;
 }
        public ActionResult Edit([FromBody] Mobility mobility)
        {
            var mob = this._mobilityService.UpdateMobility(mobility);

            if (mob == null)
            {
                return(NotFound("Mobility Not Found !"));
            }
            return(Ok("Mobility modified successfully !"));
        }
Esempio n. 12
0
        //public double CalculateAsRxPower(IACell cell, GeoXYPoint point, float Linkloss)
        //{
            //double m_TRXPower = ((GSMTRX)cell).MaxPower;
            //GSMTRX isGSMCell = cell as GSMTRX;
            //if (isGSMCell != null)
            //{
            //GSMTerminal gsmTerminal = (GSMTerminal)terminal.GetNetWorkTerminal(NetWorkType.GSM);
            //double terminalGain = gsmTerminal.Gain;
            //double serviceLoss = ((GSMService)service).BodyLoss;
            //return m_TRXPower + terminalGain - serviceLoss - linkloss;
            //}
            //else
            //{
            //    return double.NegativeInfinity;
            //}
        //    return CalculateRxPower(cell, point, Linkloss);
        //}

        public IDetail CalculateDownLinkDetail(List<RxPowerAndLinkLossModel> ModelList, GeoXYPoint point, Service service, Mobility mobility, Terminal terminal)
        {
            TargetPara target = new TargetPara();
            InitData(ModelList, service, terminal, target);
            m_DlBestCell = FindDlBestServer();
            m_IInterf = InitInterfCalc();
            DlResultImage();
            DlJudgeAccess(target);
            return dlDetail;
        }
        public ActionResult Create([FromBody] Mobility mobility)
        {
            var mob = this._mobilityService.AddMobility(mobility);

            if (mob == null)
            {
                return(BadRequest("Error Happened ! please retry"));
            }
            return(CreatedAtAction(nameof(Create), new { mob }));
        }
Esempio n. 14
0
 private void Awake()
 {
     if (shouldImmobolizePlayer.HasValue)
     {
         PlayerMobility = (shouldImmobolizePlayer.Value ? Mobility.Immobilize : Mobility.Mobile);
     }
     if (Initialize != null)
     {
         Initialize(this);
     }
 }
Esempio n. 15
0
 public void CalculateDownLinkDetail_Test2()
 {
     Service psService = new UnionPsService();
     psService.CommonType = CommonServiceType.PSService;
     GSMService gsmService = new GSMService();
     ((UnionPsService)psService).PSServiceDic.Add(NetWorkType.GSM, gsmService);
     Mobility mobility = new Mobility();
     Terminal terminal = new Terminal();
     GSMTerminal gsmTerminal = new GSMTerminal();
     gsmTerminal.NetType = NetWorkType.GSM;
     terminal.NetTerminalList.Add(gsmTerminal);
     IDetail detail = m_GSMCellCalculator.CalculateDownLinkDetail(m_ModelList, m_Point, psService, mobility, terminal);
 }
 public DirectionalLightComponent(string name, ResourceReference archetype, Vector3 relativeLocation, Rotator relativeRotation, Vector3 relativeScale3D, Node[] children, float intensity, Vector4 lightColor, Mobility mobility, bool castShadows, float specularScale, float softSourceRadius, float sourceRadius, float sourceLength, ResourceReference lightFunctionReference)
     : base(name, archetype, relativeLocation, relativeScale3D, relativeRotation, children)
 {
     Intensity              = intensity;
     LightColor             = lightColor;
     Mobility               = mobility;
     CastShadows            = castShadows;
     SpecularScale          = specularScale;
     SourceRadius           = sourceRadius;
     SourceLength           = sourceLength;
     SoftSourceRadius       = softSourceRadius;
     LightFunctionReference = lightFunctionReference;
 }
Esempio n. 17
0
        public bool PathableWith(Mobility mobility)
        {
            switch (mobility)
            {
            case Mobility.Walk:
                return(TravelCost > 0);

            case Mobility.Fly:
                return(true);
            }

            return(false);
        }
Esempio n. 18
0
 public void CommitData(Mobility newMobility, string oldName, string change)
 {
     if (change == this.ADDSTRING)
     {
         this.m_Management.AddMobility(this, newMobility);
         this.m_Mobility = this.m_Management.FindMobilityByName(newMobility.Name);
     }
     else if (change == this.MODIFYSTRING)
     {
         newMobility.ID = this.m_Mobility.ID;
         this.m_Management.ModifyMobility(oldName, newMobility);
     }
     this.m_oldName = newMobility.Name;
 }
Esempio n. 19
0
        internal Unit(Universe universe, Galaxy galaxy, ref BinaryMemoryReader reader)
        {
            ushort datas = reader.ReadUInt16();

            Mobility = (Mobility)((datas >> 6) & 0b11);

            Name = reader.ReadString();

            Galaxy = galaxy;

            Position = new Vector(ref reader);

            if (Mobility == Mobility.Still)
            {
                Movement = null;
            }
            else
            {
                Movement = new Vector(ref reader);
            }

            Radius = reader.ReadSingle();

            if ((datas & 0b00000000_00000001) == 0b00000000_00000001)
            {
                Gravity = reader.ReadSingle();
            }

            if ((datas & 0b00000000_00000010) == 0b00000000_00000010)
            {
                Radiation = reader.ReadSingle();
            }

            if ((datas & 0b00000000_00000100) == 0b00000000_00000100)
            {
                PowerOutput = reader.ReadSingle();
            }

            if ((datas & 0b00000000_00001000) == 0b00000000_00001000)
            {
                Team = universe.teams[reader.ReadByte()];
            }

            Alterable = (datas & 0b00000000_00100000) == 0b00000000_00100000;
            Phased    = (datas & 0b00000000_00010000) == 0b00000000_00010000;

            Solid      = (datas & 0b00000001_00000000) == 0b00000001_00000000;
            Masking    = (datas & 0b00000010_00000000) == 0b00000010_00000000;
            Persistent = (datas & 0b00000100_00000000) == 0b00000100_00000000;
        }
Esempio n. 20
0
 public ExponentialHeightFogComponent(
     string name,
     ResourceReference archetype,
     Vector3 relativeLocation,
     Rotator relativeRotation,
     Vector3 relativeScale3D,
     Node[] children,
     Mobility mobility,
     float fogDensity,
     float fogHeightFalloff,
     Vector4 fogInscatteringColor,
     ResourceReference inscatteringColorCubemap,
     float inscatteringColorCubemapAngle,
     Vector4 inscatteringTextureTint,
     float fullyDirectionalInscatteringColorDistance,
     float fogMaxOpacity,
     float startDistance,
     float fogCutoffDistance,
     bool enableVolumetricFog,
     float volumetricFogScatteringDistribution,
     Vector4 volumetricFogAlbedo,
     Vector4 volumetricFogEmissive,
     float volumetricFogExtinctionScale,
     float volumetricFogDistance,
     float volumetricFogStaticLightingScatteringIntensity,
     bool overrideLightColorsWithFogInscatteringColors
     )
     : base(name, archetype, relativeLocation, relativeScale3D, relativeRotation, children)
 {
     Mobility                                       = mobility;
     FogDensity                                     = fogDensity;
     FogHeightFalloff                               = fogHeightFalloff;
     FogInscatteringColor                           = fogInscatteringColor;
     InscatteringColorCubemap                       = inscatteringColorCubemap;
     InscatteringColorCubemapAngle                  = inscatteringColorCubemapAngle;
     InscatteringTextureTint                        = inscatteringTextureTint;
     FullyDirectionalInscatteringColorDistance      = fullyDirectionalInscatteringColorDistance;
     FogMaxOpacity                                  = fogMaxOpacity;
     StartDistance                                  = startDistance;
     FogCutoffDistance                              = fogCutoffDistance;
     EnableVolumetricFog                            = enableVolumetricFog;
     VolumetricFogScatteringDistribution            = volumetricFogScatteringDistribution;
     VolumetricFogAlbedo                            = volumetricFogAlbedo;
     VolumetricFogEmissive                          = volumetricFogEmissive;
     VolumetricFogExtinctionScale                   = volumetricFogExtinctionScale;
     VolumetricFogDistance                          = volumetricFogDistance;
     VolumetricFogStaticLightingScatteringIntensity = volumetricFogStaticLightingScatteringIntensity;
     OverrideLightColorsWithFogInscatteringColors   = overrideLightColorsWithFogInscatteringColors;
 }
Esempio n. 21
0
 public MobilityNewControl(string mobName, MobilityManagement iMobManagement)
 {
     this.m_MobilityDic = new Dictionary<NetWorkType, Mobility>();
     this.MOBILITY = "Mobility";
     this.ADDSTRING = "Add";
     this.MODIFYSTRING = "Modify";
     this.m_oldName = string.Empty;
     this.m_IsAddNode = false;
     this.m_Management = iMobManagement;
     this.m_IsAddNode = true;
     this.m_Mobility = this.m_Management.FindMobilityByName(mobName);
     this.m_MobilityForm = this.CreateMobilityNewForm();
     this.setMobilityFrmData(this.m_MobilityForm, mobName, this.m_Management.FindMobilityByName(mobName).MeanSpeed);
     this.m_oldName = mobName;
 }
Esempio n. 22
0
        public bool IsContained(IPerson person)
        {
            var age = person.Age;

            // Convert the age into an age category
            if (!TryGetAgeCat(age, out age))
            {
                return(false);
            }
            int mobilityCategory;
            var cars = person.Household.Cars;

            mobilityCategory = cars + (person.DriversLicense ? 3 : 0);
            return((EmploymentStatusCategory.Contains(person.EmploymentStatus)) & (OccupationCategory.Contains(person.Occupation))
                   & (AgeCategoryRange.Contains(age)) & (Mobility.Contains(mobilityCategory)));
        }
Esempio n. 23
0
        /// <summary>
        /// Updates current unit with passed unit
        /// No checks
        /// </summary>
        /// <param name="mapUnit"></param>
        internal virtual void Update(MapUnit mapUnit)
        {
            Debug.Assert(Name == mapUnit.Name && Kind == mapUnit.Kind);

            AgeInternal = 0;

            mobility   = mapUnit.Mobility;
            isOrbiting = mapUnit.IsOrbiting;
            isMasking  = mapUnit.IsMasking;
            isSolid    = mapUnit.IsSolid;

            gravity = mapUnit.gravity;

            PositionInternal = mapUnit.PositionInternal;
            MovementInternal = mapUnit.MovementInternal;
        }
Esempio n. 24
0
 public override double[] compareTo(Part otherPart)
 {
     if (otherPart.GetType() == this.GetType())
     {
         List <double> differenceInStats = new List <double>();
         Mobility      comparablePart    = (Mobility)otherPart;
         differenceInStats.AddRange(base.compareTo(otherPart));
         differenceInStats.Add(comparablePart.getClimbAngle() - CLIMB_ANGLE);
         differenceInStats.Add(comparablePart.getMaxSpeed() - MAX_SPEED);
         differenceInStats.Add(comparablePart.getMaxForce() - MAX_FORCE);
         return(differenceInStats.ToArray());
     }
     else
     {
         return(base.compareTo(otherPart));
     }
 }
Esempio n. 25
0
    public Part partDataToPart(PartData partData)
    {
        Part  part  = null;
        Image image = new Image(partData.image);

        switch (partData.partType)
        {
        case "Head":
            part = new Head(partData.id, image, partData.weight, (Shape.SHAPES)Enum.Parse(typeof(Shape.SHAPES), partData.shape), partData.durability, partData.durability);
            break;

        case "Body":
            part = new Body(partData.id, image, partData.weight, (Shape.SHAPES)Enum.Parse(typeof(Shape.SHAPES), partData.shape), partData.durability, partData.durability, partData.maxAttachments);
            break;

        case "Mobility":
            part = new Mobility(partData.id, image, partData.weight, (Shape.SHAPES)Enum.Parse(typeof(Shape.SHAPES), partData.shape), partData.durability, partData.durability, partData.climbAngle, partData.maxSpeed, partData.maxForce);
            break;

        default:
            Type partType = Type.GetType(partData.partType);
            ConstructorInfo[] constructorInfo = partType.GetConstructors();
            ParameterInfo[]   parameters      = constructorInfo[0].GetParameters();
            Effect <Robot>    effect;
            if (partData.effect == null)
            {
                effect = null;
            }
            else
            {
                Type effectType = Type.GetType(partData.effect);
                ConstructorInfo[] effectConstructorInfo = effectType.GetConstructors();
                ParameterInfo[]   effectParameters      = effectConstructorInfo[0].GetParameters();
                object[]          parameterValues       = new object[effectParameters.Length];
                for (int parameterIndex = 0; parameterIndex < effectParameters.Length; ++parameterIndex)
                {
                    parameterValues[parameterIndex] = 0;
                }
                effect = (Effect <Robot>)effectConstructorInfo[0].Invoke(parameterValues);
            }
            part = (Part)constructorInfo[0].Invoke(new object[] { partData.id, image, partData.weight, effect, (Shape.SHAPES)Enum.Parse(typeof(Shape.SHAPES), partData.shape), partData.durability, partData.durability, partData.minChargeTime, partData.maxChargeTime, partData.minCoolingTime, partData.maxDamage });
            break;
        }
        return(part);
    }
Esempio n. 26
0
        /// <summary>
        /// Get the combined modifier code for the coding scheme.
        /// </summary>
        /// <param name="symbolCode">the symbol code</param>
        /// <returns>a friendly name for the combined modifier code</returns>
        public static string GetName(string symbolCode)
        {
            if (!SymbolData.Check(ref symbolCode))
            {
                return(string.Empty);
            }

            char leadCode  = ModifierCode.GetCode(symbolCode);
            char trailCode = Echelon.GetCode(symbolCode);

            if (leadCode == ModifierCode.Mobility || leadCode == ModifierCode.Towed)
            {
                return(Mobility.GetName(symbolCode));
            }

            if (leadCode == ModifierCode.Installation)
            {
                return((trailCode == 'B') ? "Feint Dummy Installation" : "Installation");
            }

            string mod = ModifierCode.GetName(symbolCode);
            string ech = Echelon.GetName(symbolCode);

            if (string.IsNullOrEmpty(mod) || string.IsNullOrEmpty(ech))
            {
                return(string.Empty);
            }

            if (mod == "None" && ech == "None")
            {
                return(string.Empty);
            }

            if (mod == "None")
            {
                return(ech);
            }

            if (ech == "None")
            {
                return(mod);
            }

            return(mod + "\n" + ech);
        }
Esempio n. 27
0
        /// <summary>
        /// Optimized ctor for own map units
        /// </summary>
        /// <param name="map"></param>
        /// <param name="kind"></param>
        /// <param name="radius"></param>
        /// <param name="name"></param>
        /// <param name="mobility"></param>
        /// <param name="isOrbiting"></param>
        /// <param name="isMasking"></param>
        /// <param name="isSolid"></param>
        /// <param name="gravity"></param>
        /// <param name="position"></param>
        /// <param name="movement"></param>
        /// <param name="movementOffset"></param>
        /// <param name="orbitingCenter"></param>
        /// <param name="orbitingList"></param>
        internal MapUnit(Map map,
                         UnitKind kind,
                         float radius,
                         string name,
                         Mobility mobility,
                         bool isOrbiting,
                         bool isMasking,
                         bool isSolid,
                         float gravity,
                         Vector position,
                         Vector movement,
                         Vector orbitingCenter = null,
                         IEnumerable <OrbitingState> orbitingList = null)
        {
            Map = map;

            Kind           = kind;
            RadiusInternal = radius;
            Name           = name;

            this.mobility   = mobility;
            this.isOrbiting = isOrbiting;
            this.isMasking  = isMasking;
            this.isSolid    = isSolid;

            this.gravity = gravity;

            PositionInternal = position;
            MovementInternal = movement;

            if (isOrbiting)
            {
                OrbitingCenter = orbitingCenter;

                this.orbitingList = new List <UnitOrbitingState>();

                foreach (var orbitingState in orbitingList)
                {
                    this.orbitingList.Add(new UnitOrbitingState(orbitingState));
                }
            }

            AgeInternal = 0;
        }
Esempio n. 28
0
        public void MobilityTest()
        {
            string gc = Mobility.GetCode(string.Empty);

            Assert.AreEqual(gc, string.Empty);
            gc = Mobility.GetCode(null);
            Assert.AreEqual(gc, string.Empty);
            gc = Mobility.GetCode("qqqqqqqqqqqqqqq");
            Assert.AreEqual(gc, "QQ");
            string str = Mobility.GetName(string.Empty);

            Assert.AreEqual(str, string.Empty);
            str = Mobility.GetName(null);
            Assert.AreEqual(str, string.Empty);
            str = Mobility.GetName("qqqqqqqqqqqqqqq");
            Assert.AreEqual(str, string.Empty);
            str = Mobility.GetName("qqpqqqqqqqmwqqq");
            Assert.AreEqual(str, "Pack Animals");
        }
Esempio n. 29
0
        ///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + PaintScheme.GetHashCode();
                hash = (hash * 29) + Mobility.GetHashCode();
                hash = (hash * 29) + Damage.GetHashCode();
                hash = (hash * 29) + Smoke.GetHashCode();
                hash = (hash * 29) + Flaming.GetHashCode();
                hash = (hash * 29) + FrozenStatus.GetHashCode();
                hash = (hash * 29) + PowerPlantStatus.GetHashCode();
                hash = (hash * 29) + State.GetHashCode();
            }

            return(hash);
        }
Esempio n. 30
0
 private void createPreviewRobot()
 {
     previewRobotParts = new List <Part>();
     for (int partIndex = 0; partIndex < currentRobot.getParts().Length; ++partIndex)
     {
         if (currentRobot.getParts()[partIndex].GAME_OBJECT != null)
         {
             previewRobotParts.Add(currentRobot.getParts()[partIndex].clone(false));
         }
         else
         {
             Part currentPart      = currentRobot.getParts()[partIndex];
             Part previewRobotPart = null;
             if (currentPart is Head)
             {
                 previewRobotPart = new Head(currentPart.getID(), currentPart.getImage(), currentPart.getWeight(), currentPart.getShape(), currentPart.getDurability(), currentPart.getRemainingDurability());
             }
             else if (currentPart is Body)
             {
                 previewRobotPart = new Body(currentPart.getID(), currentPart.getImage(), currentPart.getWeight(), currentPart.getShape(), currentPart.getDurability(), currentPart.getRemainingDurability(), ((Body)currentPart).getMaxAttachments());
             }
             else if (currentPart is Mobility)
             {
                 previewRobotPart = new Mobility(currentPart.getID(), currentPart.getImage(), currentPart.getWeight(), currentPart.getShape(), currentPart.getDurability(), currentPart.getRemainingDurability(), ((Mobility)currentPart).getClimbAngle(), ((Mobility)currentPart).getMaxSpeed(), ((Mobility)currentPart).getMaxForce());
             }
             if (!(currentPart is Attachment))
             {
                 previewRobotParts.Add(previewRobotPart);
             }
         }
         if (partIndex < previewRobotParts.Count)
         {
             previewRobotParts[partIndex].toggleGameObject(true);
         }
     }
     previewRobot = new Robot("", false, true, previewRobotParts.ToArray());
     previewRobot.GAME_OBJECT.GetComponent <Rigidbody>().useGravity = false;
     previewRobot.setPosition(new Point(0, -previewRobot.getBody().GAME_OBJECT.transform.position.y, 500));
     previewRobot.GAME_OBJECT.transform.localScale       = new Vector3(100, 100, 100);
     previewRobot.GAME_OBJECT.transform.localEulerAngles = new Vector3(0, 180, 0);
 }
Esempio n. 31
0
 public VectorMapPropertiesFrm(TreeNode vetNode, IApplicationContext context)
 {
     this.m_HandleMap = new Dictionary<int, ProcessChangedHandle>();
     this.m_VectorMap = null;
     this.m_IsExistsNode = false;
     this.m_TrafficModelService = null;
     this.m_RemoveColorPolygon = new List<GeoPolygonRegion>();
     this.m_OldVectorMap = null;
     this.m_BakClutterClassList = null;
     this.m_BakSelectedVectorList = null;
     this.m_BakDensity = 0f;
     this.m_BakUserProfile = null;
     this.m_BakMobility = null;
     this.components = null;
     this.InitParam(context);
     this.InitializeComponent();
     this.m_TrafficNode = vetNode;
     this.m_VectorMap = new VectorTrafficMap(context);
     this.CopyDataToVetorMap(vetNode);
     this.m_IsExistsNode = true;
     this.SetMapVisibleFlag(vetNode);
     this.oldName = this.m_VectorMap.Name;
 }
        ///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + PaintScheme.GetHashCode();
                hash = (hash * 29) + Mobility.GetHashCode();
                hash = (hash * 29) + FirePower.GetHashCode();
                hash = (hash * 29) + Damage.GetHashCode();
                hash = (hash * 29) + Smoke.GetHashCode();
                hash = (hash * 29) + TrailingEffects.GetHashCode();
                hash = (hash * 29) + Hatch.GetHashCode();
                hash = (hash * 29) + HeadLights.GetHashCode();
                hash = (hash * 29) + TailLights.GetHashCode();
                hash = (hash * 29) + BrakeLights.GetHashCode();
                hash = (hash * 29) + Flaming.GetHashCode();
                hash = (hash * 29) + Launcher.GetHashCode();
                hash = (hash * 29) + CamouflageType.GetHashCode();
                hash = (hash * 29) + Concealed.GetHashCode();
                hash = (hash * 29) + FrozenStatus.GetHashCode();
                hash = (hash * 29) + PowerPlantStatus.GetHashCode();
                hash = (hash * 29) + State.GetHashCode();
                hash = (hash * 29) + Tent.GetHashCode();
                hash = (hash * 29) + Ramp.GetHashCode();
                hash = (hash * 29) + BlackoutLights.GetHashCode();
                hash = (hash * 29) + BlackoutBrakeLights.GetHashCode();
                hash = (hash * 29) + SpotLights.GetHashCode();
                hash = (hash * 29) + InteriorLights.GetHashCode();
                hash = (hash * 29) + SurrenderState.GetHashCode();
                hash = (hash * 29) + MaskedCloaked.GetHashCode();
            }

            return(hash);
        }
Esempio n. 33
0
 private void SaveGenerationData(float totalProduction)
 {
     if (!String.IsNullOrEmpty(GenerationOutputFileName))
     {
         bool first = !File.Exists(GenerationOutputFileName);
         // if the file name exists try to write to it, appending
         using (StreamWriter writer = new StreamWriter(GenerationOutputFileName, true))
         {
             if (first)
             {
                 writer.WriteLine("Age,Employment,Occupation,Mobility,Total");
             }
             writer.Write(AgeCategoryRange.ToString());
             writer.Write(',');
             writer.Write(EmploymentStatusCategory.ToString());
             writer.Write(',');
             writer.Write(OccupationCategory.ToString());
             writer.Write(',');
             writer.Write(Mobility.ToString());
             writer.Write(',');
             writer.WriteLine(totalProduction);
         }
     }
 }
Esempio n. 34
0
 //构造使用PS业务的用户
 public static User CreatUser_PS()
 {
     Mobility mobility = new Mobility("mobility", 30);
     //构造业务参数
     UnionPsService unionPsService = new UnionPsService();
     Dictionary<NetWorkType, Service> PSServiceDic = new Dictionary<NetWorkType, Service>();
     TDPsService tdPsService = new TDPsService();
     tdPsService.TDR99Bearer = new TDR99Bearer();
     PSServiceDic.Add(NetWorkType.TDSCDMA, tdPsService);
     unionPsService.PSServiceDic = PSServiceDic;
     //构造终端参数
     Terminal terminal = new Terminal();
     List<NetworkTerminal> terminalList = new List<NetworkTerminal>();
     TDTerminal tempTerminal = new TDTerminal();
     tempTerminal.NoiseFigure = 2;
     tempTerminal.NetType = NetWorkType.TDSCDMA;
     tempTerminal.MinTxPower = 24;
     tempTerminal.MaxTxPower = 36;
     terminalList.Add(tempTerminal);
     terminal.NetTerminalList = terminalList;
     User user = new User(mobility, unionPsService, terminal, LinkType.Uplink, 1);
     user.Id = 1;
     return user;
 }
Esempio n. 35
0
        private void WriteAttractionFile(SparseArray <float> attractions)
        {
            if (!AttractionFileName.ContainsFileName())
            {
                return;
            }
            var           flatAttractions = attractions.GetFlatData();
            bool          first           = !File.Exists(AttractionFileName.GetFileName());
            StringBuilder buildInside     = new StringBuilder();

            buildInside.Append(',');
            buildInside.Append(AgeCategoryRange.ToString());
            buildInside.Append(',');
            buildInside.Append(EmploymentStatusCategory.ToString());
            buildInside.Append(',');
            buildInside.Append(OccupationCategory.ToString());
            buildInside.Append(',');
            buildInside.Append(Mobility.ToString());
            buildInside.Append(',');
            string categoryData = buildInside.ToString();

            using (StreamWriter writer = new StreamWriter(AttractionFileName.GetFileName(), true))
            {
                if (first)
                {
                    // if we are the first thing to generate, then write the header as well
                    writer.WriteLine("Zone,Age,Employment,Occupation,Mobility,Attraction");
                }
                for (int i = 0; i < flatAttractions.Length; i++)
                {
                    writer.Write(attractions.GetSparseIndex(i));
                    writer.Write(categoryData);
                    writer.WriteLine(flatAttractions[i]);
                }
            }
        }
Esempio n. 36
0
 public VectorMapPropertiesFrm(IApplicationContext context, TrafficMapView inTrafficMapView, List<NetWorkType> netTypeList)
 {
     this.m_HandleMap = new Dictionary<int, ProcessChangedHandle>();
     this.m_VectorMap = null;
     this.m_IsExistsNode = false;
     this.m_TrafficModelService = null;
     this.m_RemoveColorPolygon = new List<GeoPolygonRegion>();
     this.m_OldVectorMap = null;
     this.m_BakClutterClassList = null;
     this.m_BakSelectedVectorList = null;
     this.m_BakDensity = 0f;
     this.m_BakUserProfile = null;
     this.m_BakMobility = null;
     this.components = null;
     this.InitParam(context);
     this.InitializeComponent();
     this.m_TrafficMapView = inTrafficMapView;
     this.m_netTypeList = netTypeList;
     this.m_VectorMap = new VectorTrafficMap(context);
     this.oldName = this.m_VectorMap.Name;
 }
Esempio n. 37
0
 public IDetail CalculateUpLinkDetail(List<RxPowerAndLinkLossModel> ModelList, GeoXYPoint point, Service service, Terminal terminal, Mobility mobility)
 {
     TargetPara target = new TargetPara();
     InitData(ModelList, service, terminal, target);
     m_UlBestCell = FindUlBestServer();
     UlResultImage();
     UlJudgeAccess(target);
     return ulDetail;
 }
Esempio n. 38
0
 public bool IsMobilityPropertyValid(Mobility newMobility, string oldName, string change, ref string info)
 {
     if (!this.IsNameValid(newMobility.Name, oldName, change, ref info))
     {
         return false;
     }
     if ((newMobility.MeanSpeed > 32768f) || (newMobility.MeanSpeed < 0f))
     {
         return false;
     }
     return true;
 }
Esempio n. 39
0
    // Update is called once per frame
    void Update()
    {
        //if player presses e (scan button)
        if (Input.GetKeyDown(KeyCode.E))
        {
            //if the scan box is already up, we turn it off instead
            if (scanBackgroundImage.enabled == false)
            {
                //fire raycast from center of the camera/screen
                Ray        ray = cam.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
                RaycastHit hit;

                //if the raycast hit something (with a mesh renderer)
                if (Physics.Raycast(ray, out hit))
                {
                    //reference to the target
                    GameObject target = hit.transform.gameObject;

                    //everything properties - all objects will have this
                    PropertiesBase properties = target.GetComponent <PropertiesBase>();

                    if (properties == null)
                    {
                        scanBackgroundImage.enabled = false;
                        scanText.enabled            = false;
                        return;
                    }

                    //turn on the gui
                    scanBackgroundImage.enabled = true;
                    scanText.enabled            = true;

                    //master string all of the information will populate
                    string output = "";

                    //the string is populated with different information based on what properties it has
                    string         creator  = properties.creator;
                    string         species  = properties.species;
                    Mobility       mobility = properties.mobility;
                    Defense        defense  = properties.defense;
                    Size           size     = properties.size;
                    List <Special> special  = properties.special;

                    output = $"Creator: {creator}\n" +
                             $"Species: {species}\n" +
                             $"Mobility: {mobility}\n" +
                             $"Defence: {defense}\n" +
                             $"Size: {size}\n";

                    foreach (Special s in special)
                    {
                        output += s.ToString() + "\n";
                    }

                    PropertiesNonAnimal nonAnimalProperties = target.GetComponent <PropertiesNonAnimal>();
                    PropertiesAnimal    animalProperties    = target.GetComponent <PropertiesAnimal>();
                    if (nonAnimalProperties != null)
                    {
                        //nonanimal properties
                        Tangibility tangibility = nonAnimalProperties.tangibility;
                        output += $"Tangibility: {tangibility.ToString()} \n";
                    }
                    else if (animalProperties != null)
                    {
                        //animal properties
                        Diet     diet     = animalProperties.diet;
                        Activity activity = animalProperties.activity;
                        Strength strength = animalProperties.strength;
                        Speed    speed    = animalProperties.speed;

                        output += $"Diet: {diet}\n" +
                                  $"Activity: {activity}\n" +
                                  $"Strength: {strength}\n" +
                                  $"Speed: {speed}\n";
                    }

                    //assign the string to the text output
                    scanText.text = output;
                }
                else
                {
                    scanBackgroundImage.enabled = false;
                    scanText.enabled            = false;
                }
            }
            else
            {
                //didn't hit anything or want to stop scanning - turn the gui off
                scanBackgroundImage.enabled = false;
                scanText.enabled            = false;
                // print("I'm looking at nothing!");
            }
        }
        //if player presses escape, also turn the gui off
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            scanBackgroundImage.enabled = false;
            scanText.enabled            = false;
        }
    }
Esempio n. 40
0
    private async void initializeScene(string sceneName) //test stuff inside! will need to be rewritten for actual game
    {
        running        = true;
        saveDataThread = new Thread(saveData);
        saveDataThread.Start();
        if (currentSettings == "")
        {
            currentSettings = SettingsManager.DEFAULT_SETTINGS;
        }
        SettingPairs settingPairs = settingsManager.getSettingPairs(currentSettings);

        settingList = settingsManager.getSettingList(currentSettings);
        fieldSize   = Field.getFieldSize(settingPairs.field_size);
        foreach (PartData partData in partsData)
        {
            Part part = partManager.partDataToPart(partData);
            if (part.GAME_OBJECT != null)
            {
                part.toggleGameObject(false);
            }
            parts.Add(part);
        }
        if (currentTest == TESTS.BUILD_HUB)
        {
            IconGenerator iconGenerator = new IconGenerator();
            Camera        camera        = null;
            foreach (Camera currCam in Camera.allCameras)
            {
                if (currCam.name == "IconCamera")
                {
                    camera = currCam;
                    camera.forceIntoRenderTexture = true;
                    break;
                }
            }
            iconGenerator.camera      = camera;
            Camera.main.targetDisplay = 1;
            foreach (Part part in parts)
            {
                if (part.GAME_OBJECT == null)
                {
                    continue;
                }
                part.toggleGameObject(true);
                part.GAME_OBJECT.transform.Rotate(new Vector3(9, 120, -15));
                iconGenerator.gameObjectOfIcon = part.GAME_OBJECT;
                while (part.getIcon() == null)
                {
                    if (part.GAME_OBJECT.GetComponent <Renderer>().isVisible)
                    {
                        iconGenerator.initialize();
                        if (iconGenerator.getIcon() != null)
                        {
                            part.setIcon(iconGenerator.getIcon());
                        }
                    }
                    if (part.getIcon() == null)
                    {
                        await Task.Delay(25);
                    }
                }
                part.toggleGameObject(false);
                part.destroyGameObject();
            }
            Camera.main.targetDisplay = 0;
        }
        else
        {
            foreach (Part part in parts)
            {
                if (part.GAME_OBJECT != null)
                {
                    part.destroyGameObject();
                }
            }
        }
        experience = playerData.experience;
        credits    = playerData.credits;
        previousRoundDamageDifference    = playerData.previousRoundDamageDifference;
        previousRoundMaxDamageDifference = playerData.previousRoundMaxDamageDifference;
        previousRoundTimeElapsed         = playerData.previousRoundTimeElapsed;
        ObstacleGenerator obstacleGenerator = new ObstacleGenerator(experience, settingPairs.max_obstacles, fieldSize);

        humanRobotParts = new List <Part>();
        obstaclesData   = new List <ObstacleData>();
        List <int> badIndices = new List <int>();
        PerformanceMetricCalculator performanceMetricCalculator = new PerformanceMetricCalculator();
        Head     cheapestHead     = null;
        Body     cheapestBody     = null;
        Mobility cheapestMobility = null;
        Blaster  cheapestBlaster  = null;

        foreach (Part part in parts)
        {
            if (part is Head && (cheapestHead == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestHead)))
            {
                cheapestHead = (Head)part;
            }
            else if (part is Body && (cheapestBody == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBody)))
            {
                cheapestBody = (Body)part;
            }
            else if (part is Mobility && (cheapestMobility == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestMobility)))
            {
                cheapestMobility = (Mobility)part;
            }
            else if (part is Blaster && (cheapestBlaster == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBlaster)))
            {
                cheapestBlaster = (Blaster)part;
            }
        }
        if (playerData.humanRobotParts != default)
        {
            for (int partIndex = 0; partIndex < playerData.humanRobotParts.Length; ++partIndex)
            {
                PlayerPartData playerPartData = playerData.humanRobotParts[partIndex];
                if (parts.Exists(p => p.getID() == playerPartData.id))
                {
                    Part part = parts.Find(p => p.getID() == playerPartData.id);
                    part.damage(part.getDurability() - playerPartData.remainingDurability);
                    if (part is Head)
                    {
                        humanRobotParts.Add((Head)part.clone(true));
                    }
                    else if (part is Body)
                    {
                        humanRobotParts.Add((Body)part.clone(true));
                    }
                    else if (part is Mobility)
                    {
                        humanRobotParts.Add((Mobility)part.clone(true));
                    }
                    else if (part is Attachment)
                    {
                        humanRobotParts.Add((Attachment)part.clone(true));
                    }
                }
                else
                {
                    humanRobotParts.Add(null);
                    badIndices.Add(partIndex);
                }
            }
        }
        else
        {
            humanRobotParts.AddRange(new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster });
        }
        myRobots = new List <Robot>();
        if (playerData.myRobots != default)
        {
            foreach (RobotData robotData in playerData.myRobots)
            {
                List <Part> robotPartList = new List <Part>();
                foreach (int partIndex in robotData.partIndices)
                {
                    if (!badIndices.Contains(partIndex))
                    {
                        robotPartList.Add(humanRobotParts[partIndex]);
                    }
                }
                try
                {
                    Robot robot = new Robot(robotData.name, true, robotData.human, robotPartList.ToArray());
                    myRobots.Add(robot);
                }
                catch {}
            }
        }
        foreach (int index in badIndices)
        {
            humanRobotParts.RemoveAt(index);
        }
        if (!humanRobotParts.Exists(part => part is Head))
        {
            humanRobotParts.Add(cheapestHead);
        }
        if (!humanRobotParts.Exists(part => part is Body))
        {
            humanRobotParts.Add(cheapestBody);
        }
        if (!humanRobotParts.Exists(part => part is Mobility))
        {
            humanRobotParts.Add(cheapestMobility);
        }
        if (!humanRobotParts.Exists(part => part is Attachment && ((Attachment)part).isWeapon()))
        {
            humanRobotParts.Add(cheapestBlaster);
        }
        if (humanRobotParts.Contains(null))
        {
            throw new Exception("There are missing part files. There neeeds to be at least one part file each of types Head, Body, Mobility, and a weapon Attachment.");
        }
        if (playerData.obstacles != default)
        {
            obstaclesData.AddRange(playerData.obstacles);
        }
        else
        {
            obstaclesData.AddRange(obstacleGenerator.getObstaclesData());
        }
        if (currentSettingValueList.Count == 0)
        {
            foreach (Setting setting in settingList)
            {
                currentSettingValueList.Add(setting.currentValue);
            }
        }
        Head       head1       = null;
        Head       head2       = null;
        Body       body1       = null;
        Body       body2       = null;
        Mobility   mobility    = null;
        Attachment attachment1 = null;
        Attachment attachment2 = null;
        Attachment attachment3 = null;

        foreach (Part part in parts)
        {
            if (part is Head)
            {
                if (head1 == null)
                {
                    head1 = (Head)part.clone(true);
                    head1.damage(2);
                }
                else if (head2 == null)
                {
                    head2 = (Head)part.clone(true);
                    head2.damage(3);
                }
            }
            else if (part is Body)
            {
                if (body1 == null)
                {
                    body1 = (Body)part.clone(true);
                    body1.damage(3);
                }
                else if (body2 == null)
                {
                    body2 = (Body)part.clone(true);
                    body2.damage(4);
                }
            }
            else if (part is Mobility)
            {
                if (mobility == null)
                {
                    mobility = (Mobility)part.clone(true);
                    mobility.damage(1);
                }
            }
            else if (part is Attachment)
            {
                if (attachment1 == null)
                {
                    attachment1 = (Attachment)part.clone(true);
                    attachment1.damage(1);
                }
                else if (attachment2 == null)
                {
                    attachment2 = (Attachment)part.clone(true);
                    attachment2.damage(1);
                }
                else if (attachment3 == null)
                {
                    attachment3 = (Attachment)part.clone(true);
                    attachment3.damage(3);
                }
            }
        }
        List <Robot> robots = new List <Robot>();
        int          numberOfNonHumanRobots = 0;
        int          numberOfHumanRobots    = 0;

        Obstacle[]           obstacles      = null;
        List <BuildHubState> buildHubStates = default;

        if (buildHubStatesData != default && buildHubStatesData.Count > 0)
        {
            buildHubStates = new List <BuildHubState>();
            foreach (BuildHubStateData buildHubStateData in buildHubStatesData)
            {
                buildHubStates.Add(buildHubStateDataManager.stateDataToState(buildHubStateData));
            }
        }
        List <FieldState> fieldStates = default;

        if (fieldStatesData != default && fieldStatesData.Count > 0)
        {
            fieldStates = new List <FieldState>();
            foreach (FieldStateData fieldStateData in fieldStatesData)
            {
                fieldStates.Add(fieldStateDataManager.stateDataToState(fieldStateData, parts));
            }
        }
        BuildHub.MODES mode;
        switch (currentTest)
        {
        case TESTS.FIELD:
        case TESTS.HUMAN_V_VOID_ROBOT:
            List <Part> humanParts = new List <Part>();
            foreach (Part part in humanRobot.getParts())
            {
                Part clonePart = part.clone(false);
                if (clonePart is Head)
                {
                    clonePart = (Head)clonePart;
                }
                else if (clonePart is Body)
                {
                    clonePart = (Body)clonePart;
                }
                else if (clonePart is Mobility)
                {
                    clonePart = (Mobility)clonePart;
                }
                else if (clonePart is Attachment)
                {
                    clonePart = (Attachment)clonePart;
                }
                humanParts.Add(clonePart);
            }
            humanRobot = new Robot(humanRobot.getName(), humanRobot.isHuman(), humanParts.ToArray());
            currentHumanRobotHealth = humanRobot.getRemainingDurability();
            Attachment[] nonHumanAttachments = { (Attachment)attachment1.clone(true) };
            numberOfNonHumanRobots = RANDOM.Next(1, settingPairs.max_ai_robots + 1);
            numberOfHumanRobots    = 1;
            obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray());
            aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, new Robot[] { humanRobot }, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience);
            robots.Add(humanRobot);
            robots.AddRange(aiManager.getAgentRobots());
            setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed));
            break;

        case TESTS.AI_AGENT_TRAINING:
            numberOfNonHumanRobots = NUMBER_OF_AGENTS;
            numberOfHumanRobots    = 0;
            obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray());
            aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, null, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience);
            Robot[] agentRobots = aiManager.getAgentRobots();
            for (int agentIndex = 0; agentIndex < NUMBER_OF_AGENTS; ++agentIndex)
            {
                FIELD_AGENT_ROBOTS[agentIndex] = agentRobots[agentIndex];
            }
            robots.AddRange(FIELD_AGENT_ROBOTS);
            setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed));
            break;

        case TESTS.BUILD_HUB:
            mode = BuildHub.MODES.MY_ROBOTS;
            setScreen(new BuildHub(settingList, obstaclesData, myRobots, humanRobotParts, parts.ToArray(), credits, mode));
            break;
        }
    }
Esempio n. 41
0
 private void InitMobilityCell()
 {
     ITrafficForMap map = this.m_ServiceContext.Lookup(typeof(ITrafficForMap).FullName) as ITrafficForMap;
     List<Mobility> mobilityList = map.MobilityList;
     List<string> list2 = new List<string>();
     foreach (Mobility mobility in mobilityList)
     {
         list2.Add(mobility.Name);
     }
     DataGridViewComboBoxCell mobilityCell = this.m_TrafficGrid.Rows[1].Cells[1] as DataGridViewComboBoxCell;
     this.AddMobilityCell(mobilityList, mobilityCell);
     if (this.m_VectorMap.Mobility != null)
     {
         if (list2.Contains(this.m_VectorMap.Mobility.Name))
         {
             mobilityCell.Value = this.m_VectorMap.Mobility.Name;
         }
         else
         {
             this.m_VectorMap.Mobility = null;
         }
     }
     else if (mobilityList.Count > 0)
     {
         mobilityCell.Value = mobilityList[0].Name;
         this.m_VectorMap.Mobility = mobilityList[0];
     }
     this.m_BakMobility = this.m_VectorMap.Mobility;
 }
Esempio n. 42
0
 private void ProcessChanged()
 {
     this.BackupClutterClassList();
     this.BackupSelectedVectorList();
     this.m_BakUserProfile = this.m_VectorMap.UserProfile;
     this.m_BakMobility = this.m_VectorMap.Mobility;
     this.m_BakDensity = this.m_VectorMap.Density;
     this.UpTrafficMapData();
     this.m_NameTextBox.Text = this.m_VectorMap.Name;
     this.m_ApplyBtn.Enabled = false;
 }
Esempio n. 43
0
 public void Setup()
 {
     _sameDices      = new[] { 5, 5 };
     _differentDices = new[] { 5, 1 };
     _mobility       = new Mobility(SameDiceMax, UnfreezeAttempts);
 }
Esempio n. 44
0
        ///// <summary>
        ///// 计算一个点到一个小区的接收功率,考虑业务终端影响 
        ///// </summary>
        ///// <param name="cell">小区</param>
        ///// <param name="point">点位置</param>
        ///// <param name="LinklossAS">算上业务终端的损耗后的下行路损值</param>
        ///// <returns></returns>
        //public double CalculateAsRxPower(IACell cell, GeoXYPoint point, float LinklossAS)
        //{
        //    return CalculateRxPower(cell, point, LinklossAS);
        //}
        /// <summary>
        /// 计算下行Detail
        /// </summary>
        /// <param name="ModelList">小区的链路信息结构体List对象</param>
        /// <param name="point">当前点位置</param>
        /// <param name="service">业务</param>
        /// <param name="mobility">移动性</param>
        /// <param name="terminal">终端</param>
        /// <returns>下行TD Detial对象</returns>
        public IDetail CalculateDownLinkDetail(List<RxPowerAndLinkLossModel> ModelList,
            GeoXYPoint point, Service service, Mobility mobility, Terminal terminal)
        {
            GetDlServiceParam(service, mobility);
            CalcDlLinkEbNo(ModelList, point);
            CalcHSDPAThoughput(terminal);
            TDDownLinkDetail dlDetail = CreatDownLinkDetail();

            return (IDetail)dlDetail;
        }
Esempio n. 45
0
        /// <summary>
        /// 计算上行Detail
        /// </summary>
        /// <param name="ModelList">小区的链路信息结构体List对象</param>
        /// <param name="point">当前点位置</param>
        /// <param name="service">业务</param>
        /// <param name="mobility">移动性</param>
        /// <param name="terminal">终端</param>
        /// <returns>上行TD Detial对象</returns>
        public IDetail CalculateUpLinkDetail(List<RxPowerAndLinkLossModel> ModelList,
            GeoXYPoint point, Service service, Terminal terminal, Mobility mobility)
        {
            GetUlServiceParam(service, mobility);
            CalcUlLinkEbNo(ModelList, point, terminal);
            TDUpLinkDetail ulDetail = CreatUpLinkDetail();

            return (IDetail)ulDetail;
        }
Esempio n. 46
0
 /// <summary>
 /// 获得上行业务参数
 /// </summary>
 /// <param name="service">业务</param>
 /// <param name="mobility">移动性</param>
 private void GetUlServiceParam(Service service, Mobility mobility)
 {
     if (service is UnionCsService)
     {
         TDCsService tdCsService = GetTdCsService(service);
         m_TargetEbNo = m_TrafficAssist.GetTDR99EbNo(tdCsService.Name, mobility.Name, LinkType.Uplink);
         m_UlPG = tdCsService.TDR99Bearer.UlPG;
     }
     else
     {
         TDPsService tdPsService = GetTdPsService(service);
         m_TargetEbNo = m_TrafficAssist.GetTDR99EbNo(tdPsService.Name, mobility.Name, LinkType.Uplink);
         m_UlPG = tdPsService.TDR99Bearer.UlPG;
     }
 }
Esempio n. 47
0
 /// <summary>
 /// 获取下行业务参数
 /// </summary>
 /// <param name="service">业务</param>
 /// <param name="mobility">移动性</param>
 private void GetDlServiceParam(Service service, Mobility mobility)
 {
     if (service is UnionCsService)
     {
         TDCsService tdService = GetTdCsService(service);
         m_TargetEbNo = m_TrafficAssist.GetTDR99EbNo(tdService.Name, mobility.Name, LinkType.Downlink);
         m_DlPG = tdService.TDR99Bearer.DlPG;
         m_TxPower = tdService.TDR99Bearer.PtchMax;
     }
     else
     {
         TDPsService tdPsService = GetTdPsService(service);
         m_TargetEbNo = m_TrafficAssist.GetTDR99EbNo(tdPsService.Name, mobility.Name, LinkType.Downlink);
         m_DlPG = tdPsService.TDR99Bearer.DlPG;
         m_TxPower = tdPsService.TDR99Bearer.PtchMax;
     }
 }
Esempio n. 48
0
 private void cbxMobility_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (IsValidateParameter()) return;
     Mobility tempMobility = cbxMobility.SelectedItem as Mobility;
     if (m_CurrentMobility != tempMobility)
     {
         m_CurrentMobility = tempMobility;
         RefreshData(false);
     }
 }
Esempio n. 49
0
        private void UpdateMobility()
        {
            List<Mobility> mobilityList = ServiceHelper.Lookup<ITrafficForApplication>(m_AppContext).MobilityList;
            Mobility selectItem;
            if (cbxMobility.SelectedIndex < 0)
            {
                selectItem = null;
            }
            else
            {
                selectItem = (Mobility)cbxMobility.SelectedItem;
            }
            cbxMobility.Items.Clear();
            foreach (Mobility mobility in mobilityList)
            {
                int index = cbxMobility.Items.Add(mobility);
                if (mobility == selectItem)
                {
                    cbxMobility.SelectedIndex = index;
                }
            }
            if (cbxMobility.SelectedIndex < 0 && cbxMobility.Items.Count > 0)
            {
                //默认设置速率为50km/s,因为数据库表ServiceQuality没有速率为30的项
                cbxMobility.SelectedIndex = 1;
            }

            if (cbxMobility.SelectedIndex == -1)
            {
                m_CurrentMobility = null;
                RefreshData(false);
            }
        }