Ejemplo n.º 1
0
 public Task <CreateTargetGroupResponse> CreateTargetGroupAsync(
     string name,
     int port,
     ProtocolEnum protocol,
     string vpcId,
     TargetTypeEnum targetType,
     string healthCheckPath,
     int healthCheckIntervalSeconds,
     int healthyThresholdCount,
     int unhealthyThresholdCount,
     int healthCheckTimeoutSeconds,
     ProtocolEnum healthCheckProtocol,
     int?healthCheckPort,
     CancellationToken cancellationToken = default(CancellationToken))
 => _clientV2.CreateTargetGroupAsync(
     new CreateTargetGroupRequest()
 {
     Name                       = name,
     Port                       = port,
     Protocol                   = protocol,
     VpcId                      = vpcId,
     TargetType                 = targetType,
     HealthCheckPath            = healthCheckPath,
     HealthCheckIntervalSeconds = healthCheckIntervalSeconds,
     HealthyThresholdCount      = healthyThresholdCount,
     UnhealthyThresholdCount    = unhealthyThresholdCount,
     HealthCheckTimeoutSeconds  = healthCheckTimeoutSeconds,
     HealthCheckProtocol        = healthCheckProtocol,
     HealthCheckPort            = (healthCheckPort == null ? null : $"{healthCheckPort.Value}")
 }
     , cancellationToken).EnsureSuccessAsync();
 public TargetObject(Texture2D texture, Vector2 velocity, Vector2 position, int width, int height,
                     int viewWidth, int viewHeight, SpriteBatch sb, TargetTypeEnum targetType, int value, SpriteFont font)
     : base(texture, velocity, position, viewWidth, viewHeight, sb, font)
 {
     _boundingBox = new Rectangle((int)position.X, (int)position.Y, width, height);
     TargetType = targetType;
     Value = value;
 }
Ejemplo n.º 3
0
        private TypeReference CreateTypeReference(XmlNode node)
        {
            String         type        = GetRequiredAttribute(node, "type");
            String         refTypeEnum = GetRequiredAttribute(node, "refTypeEnum");
            TargetTypeEnum typeEnum    = (TargetTypeEnum)Enum.Parse(typeof(TargetTypeEnum), refTypeEnum);

            return(new TypeReference(LexicalInfo.Empty, type, typeEnum));
        }
Ejemplo n.º 4
0
 public bool Equals(TargetTypeEnum obj)
 {
     if ((object)obj == null)
     {
         return(false);
     }
     return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value));
 }
Ejemplo n.º 5
0
 public UseValsID(FELint.Type dataType, uint addr, string info, uint id, TargetTypeEnum targetType, uint tag = U.NOT_FOUND)
 {
     this.DataType   = dataType;
     this.Addr       = addr;
     this.Info       = info;
     this.ID         = id;
     this.TargetType = targetType;
     this.Tag        = tag;
 }
Ejemplo n.º 6
0
    public void SpawnDamager(float damage, float size, Vector3 pos, TargetTypeEnum targetType)
    {
        GameObject dmgr = GetDamager();

        dmgr.transform.localScale = Vector3.one * size;
        dmgr.transform.position   = pos + Vector3.up;
        dmgr.SetActive(true);

        dmgr.GetComponent <Damager>().InitializeDamager(damage, size, targetType, 1f);
    }
Ejemplo n.º 7
0
		public TypeReference(LexicalInfo info, String value, TargetTypeEnum targetType) : this(info)
		{
			if (targetType == TargetTypeEnum.Link)
			{
				LinkRef = value;
			}
			else
			{
				TypeName = value;
			}
		}
 public TypeReference(LexicalInfo info, String value, TargetTypeEnum targetType) : this(info)
 {
     if (targetType == TargetTypeEnum.Link)
     {
         LinkRef = value;
     }
     else
     {
         TypeName = value;
     }
 }
        public EconTraitXmlEffectTarget(
            [JsonConverter(typeof(StringEnumConverter))]
            [JsonProperty(PropertyName = "type", Required = Required.Always)] TargetTypeEnum type)
        {
            if (type == TargetTypeEnum.None)
            {
                throw new ArgumentOutOfRangeException(nameof(type), type, string.Empty);
            }

            Type = type;
        }
Ejemplo n.º 10
0
    public static string GetStringValue(this TargetTypeEnum tte)
    {
        switch (tte)
        {
        case TargetTypeEnum.Character:
            return("Character");

        case TargetTypeEnum.Enemy:
            return("Enemy");
        }

        return(null);
    }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ability"/> class.
 /// </summary>
 /// <param name="id">Identifier.</param>
 /// <param name="type">Ability Type.</param>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="toolTip">Tool tip.</param>
 /// <param name="iconPath">Icon path.</param>
 /// <param name="vfxpPath">VFX path.</param>
 /// <param name="cost">Cost.</param>
 /// <param name="turns">Turns.</param>
 /// <param name="targetType">Target type.</param>
 /// <param name="attributeCollection">Attribute collection.</param>
 public Ability(int id, AbilityType type, string name, string description, string toolTip, string iconPath, string vfxPath, int cost, int turns, TargetTypeEnum targetType, AttributeCollection attributeCollection)
 {
     Id                   = id;
     Type                 = type;
     Name                 = name;
     Description          = description;
     ToolTip              = toolTip;
     IconPath             = iconPath;
     VFXPath              = vfxPath;
     Cost                 = cost;
     Turns                = turns;
     TargetType           = targetType;
     _attributeCollection = attributeCollection;
 }
Ejemplo n.º 12
0
        public static TargetTypeEnum TagTargetTypeEnumCheck(string tag)
        {
            TargetTypeEnum result   = TargetTypeEnum.None;
            var            tagSplit = ProcessTag(tag);

            if (tagSplit.Length == 2)
            {
                if (TargetTypeEnum.TryParse(tagSplit[1], out result) == false)
                {
                    return(TargetTypeEnum.None);
                }
            }

            return(result);
        }
Ejemplo n.º 13
0
        public void Transition(TransitionSettings transitionSettings, Vector3 startAmount, Vector3 endAmount, TransitionModeType transitionMode)
        {
            // if this transition should not run then return immediately
            if (transitionSettings.TransitionType == TransitionHelper.TransitionType.none)
            {
                return;
            }

            // save transition values
            _targetType   = TargetTypeEnum.Vector3;
            _startVector3 = startAmount;
            _endVector3   = endAmount;

            // start transition
            Transition(transitionSettings, transitionMode);
        }
Ejemplo n.º 14
0
        public TargetProfile()
        {
            UseCustomTargeting = false;

            Target       = TargetTypeEnum.None;
            BlockTargets = new List <BlockTypeEnum>();

            TimeUntilTargetAcquisition = 1;
            UseTargetRefresh           = false;
            TimeUntilNextRefresh       = 60;
            TimeUntilNextEvaluation    = 1;

            MaxDistance = 12000;

            MatchAllFilters  = new List <TargetFilterEnum>();
            MatchAnyFilters  = new List <TargetFilterEnum>();
            MatchNoneFilters = new List <TargetFilterEnum>();
            GetTargetBy      = TargetSortEnum.ClosestDistance;

            Owners         = OwnerTypeEnum.None;
            Relations      = RelationTypeEnum.None;
            FactionTargets = new List <string>();

            OnlyGetFromEntityOwner      = false;
            GetFromMinorityGridOwners   = false;
            PrioritizeSpecifiedFactions = false;

            IsStatic = CheckEnum.Ignore;

            MinAltitude = -100000;
            MaxAltitude = 100000;

            NonBroadcastVisualRange = 1500;

            MinGravity = 0;
            MaxGravity = 1.1;

            MinSpeed = 0;
            MaxSpeed = 110;

            MinTargetValue = 0;
            MaxTargetValue = 1;

            ProfileSubtypeId      = "";
            BuiltUniqueFilterList = false;
            AllUniqueFilters      = new List <TargetFilterEnum>();
        }
Ejemplo n.º 15
0
        public int TargetBasedBonusCalories(TargetTypeEnum target)
        {
            switch (target)
            {
            case TargetTypeEnum.Bulk:
                return(200);

            case TargetTypeEnum.Maintain:
                return(0);

            case TargetTypeEnum.Reduction:
                return(-300);

            default:
                throw new ArgumentOutOfRangeException(nameof(target), target, null);
            }
        }
Ejemplo n.º 16
0
    public void InitializeDamager(float dmg, float diameter, TargetTypeEnum prefTarget, float lifeTime)
    {
        damage      = dmg;
        preferedTag = prefTarget.GetStringValue();
        rad         = diameter / 2;

        StartCoroutine(Alive(lifeTime));

        Collider[] hitColliders = Physics.OverlapSphere(transform.position, diameter / 2);

        for (int i = 0; i < hitColliders.Length; i++)
        {
            if (hitColliders[i].CompareTag(preferedTag))
            {
                hitColliders[i].GetComponent <UnitComponent>().GetDamage(damage);
            }
        }
    }
Ejemplo n.º 17
0
    public IMove GetIMove(TargetTypeEnum targetType)
    {
        IMove iMove = null;

        if (targetType == TargetTypeEnum.ENEMY)
        {
            iMove = MoveEnemy();
        }
        else if (targetType == TargetTypeEnum.ENERY_SUPPLY)
        {
            iMove = EnergyStation.GetInstance();
        }
        else if (targetType == TargetTypeEnum.PATROL)
        {
            iMove = PatrolMove();
        }

        return(iMove);
    }
Ejemplo n.º 18
0
    private Ability(int id, AbilityType type, string name, string description, string toolTip, string iconPath, string vfxPath, int cost, int turns, TargetTypeEnum targetType, Dictionary <AttributeEnums.AttributeType, float> attributes)
    {
        Id          = id;
        Type        = type;
        Name        = name;
        Description = description;
        ToolTip     = toolTip;
        IconPath    = iconPath;
        VFXPath     = vfxPath;
        Cost        = cost;
        Turns       = turns;
        TargetType  = targetType;

        AttributeCollection globalAttributeCollection = AttributeManager.Instance.GlobalAttributeCollection;

        if (_attributeCollection == null)
        {
            _attributeCollection = new AttributeCollection();
        }
        _attributeCollection = AttributeCollection.GetFromGlobalCollection(attributes, globalAttributeCollection, _attributeCollection);
    }
Ejemplo n.º 19
0
    private void GetIMove()
    {
        bool result = false;

        for (int i = 0; i < _parameterList.Count; ++i)
        {
            BehaviorParameter parameter = _parameterList[i];
            if (parameter.parameterName.CompareTo(BTConstant.TargetType) == 0)
            {
                _targetType = (TargetTypeEnum)parameter.intValue;
                result      = true;
            }
        }

        if (!result)
        {
            return;
        }

        _iMove = _owner.GetIMove(_targetType);
    }
Ejemplo n.º 20
0
        public void NewMealCalcWithDayOfWeekModel()
        {
            ApplicationDbContext db = new ApplicationDbContext();
            ApplicationDbContext dbDayOfWeekMeal = new ApplicationDbContext();

            var manager = new ApplicationUserManager(new UserStore <ApplicationUser>(new ApplicationDbContext()));

            foreach (var bmrUser in db.BmrCalculators)
            {
                string         userID     = bmrUser.UserId;
                TargetTypeEnum dietTarget = bmrUser.TargetType;

                int dietTargetExtraCalories = dietTarget == TargetTypeEnum.Bulk ? 50 : dietTarget == TargetTypeEnum.Reduction ? -50 : 0;
                var userEmail = manager.Users.Where(x => x.Id == userID).Select(x => x.Email);

                var dayOfWeek = (int)DateTime.Now.DayOfWeek;

                var mealOfTheDay = dbDayOfWeekMeal.DayOfWeeks.ToList().ElementAt(dayOfWeek);
                var calories     = CalcCalories(mealOfTheDay.Meals).Item1;

                var multi = (bmrUser.BaseCalories + (dietTargetExtraCalories * dayOfWeek)) / calories;

                foreach (var meal in mealOfTheDay.Meals)
                {
                    foreach (var ingredient in meal.Ingredients)
                    {
                        ingredient.Calories = (int)(ingredient.Calories * multi);
                    }
                }

                var mealNewValues = CalcCalories(mealOfTheDay.Meals, multi);

                var newcalories     = mealNewValues.Item1;
                var mealInformation = mealNewValues.Item2;

                //TODO Email notification with those calculated data
            }
        }
Ejemplo n.º 21
0
        public static IMyEntity GetTargetFromId(long entityId, out TargetTypeEnum targetType)
        {
            targetType = TargetTypeEnum.None;
            IMyEntity result = null;

            if (MyAPIGateway.Entities.TryGetEntityById(entityId, out result) == false)
            {
                return(result);
            }

            if (result as IMyCubeBlock != null)
            {
                targetType = TargetTypeEnum.Block;
            }

            if (result as IMyCubeGrid != null)
            {
                targetType = TargetTypeEnum.Grid;
            }

            if (result as IMyEngineerToolBase != null)
            {
                if (MyAPIGateway.Entities.TryGetEntityById((result as IMyEngineerToolBase).OwnerId, out result) == false)
                {
                    return(null);
                }

                targetType = TargetTypeEnum.Player;
            }

            if (result as IMyGunBaseUser != null)
            {
                result     = (result as IMyGunBaseUser).Owner;
                targetType = TargetTypeEnum.Player;
            }

            return(result);
        }
        public List <TargetTypeEnum> GetTargetTypeEnum(string adj)
        {
            List <TargetTypeEnum> result = new List <TargetTypeEnum>();
            TargetTypeEnum        model;

            if (adj == null)
            {
                model                 = new TargetTypeEnum();
                model.IfSelect        = true;
                model.TargetType      = 0;
                model.TargetTypeValue = "--请选择--";
                result.Add(model);
                for (int a = 1; a <= EnumUtil.GetItems(typeof(EnumTargetType)).Count; a++)
                {
                    model                 = new TargetTypeEnum();
                    model.IfSelect        = false;
                    model.TargetTypeValue = EnumHelper.GetEnumDescription(typeof(EnumTargetType), a);
                    model.TargetType      = a;
                    result.Add(model);
                }
            }
            else
            {
                for (int a = 1; a <= EnumUtil.GetItems(typeof(EnumTargetType)).Count; a++)
                {
                    model          = new TargetTypeEnum();
                    model.IfSelect = false;
                    if (a == int.Parse(adj))
                    {
                        model.IfSelect = true;
                    }
                    model.TargetTypeValue = EnumHelper.GetEnumDescription(typeof(EnumTargetType), a);
                    model.TargetType      = a;
                    result.Add(model);
                }
            }
            return(result);
        }
        BacklinkStore.UnusedQty ShowObjectName(BacklinkStore store, WindowData windowData, TargetTypeEnum targetTypeEnum, SearchArg arg, string[] selectedGuids)
        {
            float TextWidth()
            {
                _buf2.text = _contentBuf.text;
                return(20f + GUI.skin.button.CalcSize(_buf2).x);
            }

            if (arg == null || arg.Main == null)
            {
                return(new BacklinkStore.UnusedQty());
            }

            bool isMultiSelect = selectedGuids != null && selectedGuids.Length > 1;

            if (_contentBuf == null)
            {
                _contentBuf = new GUIContent {
                    tooltip = $"Click to ping"
                };
            }

            _contentBuf.image = isMultiSelect
                ? windowData.Style.MultiSelect.image
                : AssetPreview.GetMiniThumbnail(arg.Target);
            _contentBuf.text    = string.Empty;
            _contentBuf.tooltip = string.Empty;

            if (!isMultiSelect)
            {
                switch (targetTypeEnum)
                {
                case TargetTypeEnum.Directory:
                    if (!SearchArgMain.IsEmpty())
                    {
                        _contentBuf.text = $"{arg.Main.name} (Folder)";
                        if (GUILayout.Button(_contentBuf, windowData.Style.CurrentBtn,
                                             GUILayout.MinWidth(TextWidth())))
                        {
                            EditorGUIUtility.PingObject(arg.Main);
                        }

                        if (AskDeleteUnusedFiles(arg, arg.UnusedAssetsFiltered, windowData))
                        {
                            return(new BacklinkStore.UnusedQty());
                        }

                        if (AskDeleteUnusedScenes(arg, arg.UnusedScenesFiltered, windowData))
                        {
                            return(new BacklinkStore.UnusedQty());
                        }
                    }

                    break;

                case TargetTypeEnum.File:
                    _contentBuf.text = $"{arg.Main.name} (File Asset)";
                    if (GUILayout.Button(_contentBuf, windowData.Style.CurrentBtn,
                                         GUILayout.MinWidth(TextWidth())))
                    {
                        EditorGUIUtility.PingObject(arg.Main);
                    }

                    bool hasUnusedFile = SearchUtils.IsUnused(arg.FilePath);
                    var  previous      = GUI.enabled;
                    GUI.enabled = hasUnusedFile;

                    if (GUILayout.Button(windowData.Style.RemoveFile,
                                         windowData.Style.RemoveUnusedBtn))
                    {
                        var choice = EditorUtility.DisplayDialog(
                            title: "Asset Cleaner",
                            message:
                            $"Do you really want to remove file: \"{arg.Main.name}\"?",
                            ok: "Remove",
                            cancel: "Cancel");
                        if (choice)
                        {
                            EditorApplication.ExecuteMenuItem("File/Save Project");
                            DeleteWithMeta(arg.FilePath);
                            AssetDatabase.Refresh();
                            SearchUtils.Upd(arg);
                        }
                    }

                    GUI.enabled = previous;

                    break;

                case TargetTypeEnum.Scene:
                    _contentBuf.text = $"{arg.Main.name} (Scene)";
                    if (GUILayout.Button(_contentBuf, windowData.Style.CurrentBtn,
                                         GUILayout.MinWidth(TextWidth())))
                    {
                        EditorGUIUtility.PingObject(arg.Main);
                    }

                    bool hasUnusedScene = SearchUtils.IsUnused(arg.FilePath);
                    previous    = GUI.enabled;
                    GUI.enabled = hasUnusedScene;

                    if (GUILayout.Button(windowData.Style.RemoveScene,
                                         windowData.Style.RemoveUnusedBtn))
                    {
                        var choice = EditorUtility.DisplayDialog(
                            title: "Asset Cleaner",
                            message:
                            $"Do you really want to remove scene: {arg.Main.name}?",
                            ok: "Remove",
                            cancel: "Cancel");
                        if (choice)
                        {
                            EditorApplication.ExecuteMenuItem("File/Save Project");
                            DeleteWithMeta(arg.FilePath);
                            AssetDatabase.Refresh();
                            SearchUtils.Upd(arg);
                        }
                    }

                    GUI.enabled = previous;
                    break;

                case TargetTypeEnum.ObjectInScene:
                    _contentBuf.text = $"{arg.Main.name} (Object in Scene)";

                    if (GUILayout.Button(_contentBuf, windowData.Style.CurrentBtn,
                                         GUILayout.MinWidth(TextWidth())))
                    {
                        EditorGUIUtility.PingObject(arg.Main);
                    }

                    break;

                case TargetTypeEnum.ObjectInStage:
                    _contentBuf.image = AssetPreview.GetMiniThumbnail(arg.Target);
                    _contentBuf.text  = $"{arg.Main.name} (Object in Staging)";

                    if (GUILayout.Button(_contentBuf,
                                         windowData.Style.RemoveUnusedBtn))
                    {
                        EditorGUIUtility.PingObject(arg.Main);
                    }

                    break;

                default:
                    if (GUILayout.Button($"{arg.Main.name} (Unknown Object Type)",
                                         windowData.Style.RemoveUnusedBtn))
                    {
                        EditorGUIUtility.PingObject(arg.Main);
                    }

                    break;
                }
            }
            else
            {
                var unusedAssets = new List <string>();
                var unusedScenes = new List <string>();

                foreach (var guid in selectedGuids)
                {
                    var path = AssetDatabase.GUIDToAssetPath(guid);

                    if (store.UnusedFiles.TryGetValue(path, out _))
                    {
                        unusedAssets.Add(path);
                    }

                    else if (store.UnusedScenes.TryGetValue(path, out _))
                    {
                        unusedScenes.Add(path);
                    }

                    if (store.FoldersWithQty.TryGetValue(path, out _))
                    {
                        SearchArg searchArg = new SearchArg()
                        {
                            FilePath = path,
                            Target   = AssetDatabase.LoadAssetAtPath <DefaultAsset>(path),
                            Main     = AssetDatabase.LoadAssetAtPath <DefaultAsset>(path)
                        };
                        SearchUtils.Upd(searchArg);

                        foreach (var unusedAssetPath in searchArg.UnusedAssetsFiltered)
                        {
                            if (store.UnusedFiles.TryGetValue(unusedAssetPath, out _))
                            {
                                unusedAssets.Add(unusedAssetPath);
                            }
                        }

                        foreach (var unusedScenePath in searchArg.UnusedScenesFiltered)
                        {
                            if (store.UnusedScenes.TryGetValue(unusedScenePath, out _))
                            {
                                unusedScenes.Add(unusedScenePath);
                            }
                        }
                    }
                }

                unusedAssets = unusedAssets.Distinct().ToList();
                unusedScenes = unusedScenes.Distinct().ToList();

                var assetSize = unusedAssets.Sum(CommonUtils.Size);
                var sceneSize = unusedScenes.Sum(CommonUtils.Size);

                _contentBuf.text =
                    $"Assets: {unusedAssets.Count} ({CommonUtils.BytesToString(assetSize)}), Scenes: {unusedScenes.Count} ({CommonUtils.BytesToString(sceneSize)})";
                ;

                GUILayout.Button(_contentBuf, windowData.Style.CurrentBtn, GUILayout.MinWidth(TextWidth()));

                if (AskDeleteUnusedFiles(arg, unusedAssets, windowData))
                {
                    return(new BacklinkStore.UnusedQty());
                }

                if (AskDeleteUnusedScenes(arg, unusedScenes, windowData))
                {
                    return(new BacklinkStore.UnusedQty());
                }

                return(new BacklinkStore.UnusedQty(unusedAssets.Count, unusedScenes.Count, assetSize + sceneSize));
            }

            return(new BacklinkStore.UnusedQty());
        }
Ejemplo n.º 24
0
        static void AppendVarsID_Byte_Low(List <UseValsID> list, FELint.Type dataType, InputFormRef ifr, uint[] textIDIndexes, TargetTypeEnum targetType)
        {
            List <U.AddrResult> arlist = ifr.MakeList();

            for (int i = 0; i < ifr.DataCount; i++)
            {
                U.AddrResult ar = arlist[i];
                for (int n = 0; n < textIDIndexes.Length; n++)
                {
                    uint id = Program.ROM.u8(ar.addr + textIDIndexes[n]);
                    if (id == 0 || id >= 0x7FFF)
                    {
                        continue;
                    }
                    list.Add(new UseValsID(dataType, ar.addr, ar.name, id, targetType, (uint)i));
                }
            }
        }
 public void AddTargetCollision(int value, TargetTypeEnum targetType)
 {
     switch (targetType)
     {
         case TargetTypeEnum.Bridge:
             {
                 _hasBridge = true;
                 break;
             }
         case TargetTypeEnum.Crate:
             {
                 _roundScore += value;
                 //_roundScore += 20; //used for cheating!
                 break;
             }
         case TargetTypeEnum.Explosive:
             {
                 _roundScore += value;
                 _roundScore = _roundScore >= 0 ? _roundScore : 0;
                 break;
             }
     }
 }
        private static Tile DetermineTarget(List<Tile> tiles, TargetTypeEnum targetTypeEnum)
        {
            Tile targetTile = null;
            foreach (Tile tile in tiles)
            {
                if (targetTile == null)
                {
                    targetTile = tile;
                }
                else
                {
                    if (targetTypeEnum == TargetTypeEnum.Air)
                    {
                        if (tile.AirUnit is ITransportUnit)
                        {
                            return tile;
                        }
                        else
                        {
                            if (tile.AirUnit.CurrentStrength < targetTile.AirUnit.CurrentStrength)
                            {
                                targetTile = tile;
                            }
                        }

                    }
                    else
                    {
                        if (tile.GroundUnit is ITransportUnit)
                        {
                            return tile;
                        }
                        else
                        {
                            if (tile.GroundUnit.CurrentStrength < targetTile.GroundUnit.CurrentStrength)
                            {
                                targetTile = tile;
                            }
                        }

                    }
                }
            }
            return targetTile;
        }
        private static TargetAndJumpOffTile DetermineTarget(List<TargetAndJumpOffTile> targetAndJumpOffTiles, TargetTypeEnum targetTypeEnum)
        {
            TargetAndJumpOffTile returnValue = null;
            foreach (TargetAndJumpOffTile targetAndJumpOffTile in targetAndJumpOffTiles)
            {
                if (returnValue == null)
                {
                    returnValue = targetAndJumpOffTile;
                }
                else
                {
                    if (targetTypeEnum == TargetTypeEnum.Air)
                    {
                        if (targetAndJumpOffTile.TargetTile.AirUnit is ITransportUnit)
                        {
                            return targetAndJumpOffTile;
                        }
                        else
                        {
                            if (targetAndJumpOffTile.TargetTile.AirUnit.CurrentStrength < returnValue.TargetTile.AirUnit.CurrentStrength)
                            {
                                returnValue = targetAndJumpOffTile;
                            }
                        }

                    }
                    else
                    {
                        if (targetAndJumpOffTile.TargetTile.GroundUnit is ITransportUnit)
                        {
                            return targetAndJumpOffTile;
                        }
                        else
                        {
                            if (targetAndJumpOffTile.TargetTile.GroundUnit.CurrentStrength < returnValue.TargetTile.GroundUnit.CurrentStrength)
                            {
                                returnValue = targetAndJumpOffTile;
                            }
                        }

                    }
                }
            }
            return returnValue;
        }
Ejemplo n.º 28
0
 public Message(TargetTypeEnum targetType, string context, string targetID)
 {
     this.TargetType = targetType;
     this.Context    = context;
     this.TargetID   = targetID;
 }
Ejemplo n.º 29
0
        public void InitTags(string customData)
        {
            if (string.IsNullOrWhiteSpace(customData) == false)
            {
                var descSplit = customData.Split('\n');

                foreach (var tag in descSplit)
                {
                    //UseCustomTargeting
                    if (tag.Contains("[UseCustomTargeting:") == true)
                    {
                        this.UseCustomTargeting = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilTargetAcquisition
                    if (tag.Contains("[TimeUntilTargetAcquisition:") == true)
                    {
                        this.TimeUntilTargetAcquisition = TagHelper.TagIntCheck(tag, this.TimeUntilTargetAcquisition);
                    }

                    //UseTargetRefresh
                    if (tag.Contains("[UseTargetRefresh:") == true)
                    {
                        this.UseTargetRefresh = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilNextRefresh
                    if (tag.Contains("[TimeUntilNextRefresh:") == true)
                    {
                        this.TimeUntilNextRefresh = TagHelper.TagIntCheck(tag, this.TimeUntilNextRefresh);
                    }

                    //UseTargetLastKnownPosition
                    if (tag.Contains("[UseTargetLastKnownPosition:") == true)
                    {
                        this.UseTargetLastKnownPosition = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilNextEvaluation
                    if (tag.Contains("[TimeUntilNextEvaluation:") == true)
                    {
                        this.TimeUntilNextEvaluation = TagHelper.TagIntCheck(tag, this.TimeUntilNextEvaluation);
                    }

                    //Target
                    if (tag.Contains("[Target:") == true)
                    {
                        this.Target = TagHelper.TagTargetTypeEnumCheck(tag);
                    }

                    //BlockTargets
                    if (tag.Contains("[BlockTargets:") == true)
                    {
                        var tempValue = TagHelper.TagBlockTargetTypesCheck(tag);

                        if (tempValue != BlockTypeEnum.None && this.BlockTargets.Contains(tempValue) == false)
                        {
                            this.BlockTargets.Add(tempValue);
                        }
                    }

                    //GetTargetBy
                    if (tag.Contains("[GetTargetBy:") == true)
                    {
                        this.GetTargetBy = TagHelper.TagTargetSortEnumCheck(tag);
                    }

                    //MaxDistance
                    if (tag.Contains("[MaxDistance:") == true)
                    {
                        this.MaxDistance = TagHelper.TagDoubleCheck(tag, this.MaxDistance);
                    }

                    //MatchAllFilters
                    if (tag.Contains("[MatchAllFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !this.MatchAllFilters.Contains(tempValue))
                        {
                            this.MatchAllFilters.Add(tempValue);
                        }
                    }

                    //MatchAnyFilters
                    if (tag.Contains("[MatchAnyFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !this.MatchAnyFilters.Contains(tempValue))
                        {
                            this.MatchAnyFilters.Add(tempValue);
                        }
                    }

                    //MatchNoneFilters
                    if (tag.Contains("[MatchNoneFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !this.MatchNoneFilters.Contains(tempValue))
                        {
                            this.MatchNoneFilters.Add(tempValue);
                        }
                    }

                    //Owners
                    if (tag.Contains("[Owners:") == true)
                    {
                        var tempValue = TagHelper.TagTargetOwnerEnumCheck(tag);

                        if (!this.Owners.HasFlag(tempValue))
                        {
                            this.Owners |= tempValue;
                        }
                    }

                    //Relations
                    if (tag.Contains("[Relations:") == true)
                    {
                        var tempValue = TagHelper.TagTargetRelationEnumCheck(tag);

                        if (this.Relations.HasFlag(tempValue) == false)
                        {
                            this.Relations |= tempValue;
                        }
                    }

                    //FactionTargets
                    if (tag.Contains("[FactionTargets:") == true)
                    {
                        var tempValue = TagHelper.TagStringCheck(tag);

                        if (!string.IsNullOrWhiteSpace(tempValue) && !this.FactionTargets.Contains(tempValue))
                        {
                            this.FactionTargets.Add(tempValue);
                        }
                    }

                    //OnlyGetFromEntityOwner
                    if (tag.Contains("[OnlyGetFromEntityOwner:") == true)
                    {
                        this.OnlyGetFromEntityOwner = TagHelper.TagBoolCheck(tag);
                    }

                    //GetFromMinorityGridOwners
                    if (tag.Contains("[GetFromMinorityGridOwners:") == true)
                    {
                        this.GetFromMinorityGridOwners = TagHelper.TagBoolCheck(tag);
                    }

                    //PrioritizeSpecifiedFactions
                    if (tag.Contains("[PrioritizeSpecifiedFactions:") == true)
                    {
                        this.PrioritizeSpecifiedFactions = TagHelper.TagBoolCheck(tag);
                    }

                    //IsStatic
                    if (tag.Contains("[IsStatic:") == true)
                    {
                        this.IsStatic = TagHelper.TagCheckEnumCheck(tag);
                    }

                    //MinAltitude
                    if (tag.Contains("[MinAltitude:") == true)
                    {
                        this.MinAltitude = TagHelper.TagDoubleCheck(tag, this.MinAltitude);
                    }

                    //MaxAltitude
                    if (tag.Contains("[MaxAltitude:") == true)
                    {
                        this.MaxAltitude = TagHelper.TagDoubleCheck(tag, this.MaxAltitude);
                    }

                    //NonBroadcastVisualRange
                    if (tag.Contains("[NonBroadcastVisualRange:") == true)
                    {
                        this.NonBroadcastVisualRange = TagHelper.TagDoubleCheck(tag, this.NonBroadcastVisualRange);
                    }

                    //MinGravity
                    if (tag.Contains("[MinGravity:") == true)
                    {
                        this.MinGravity = TagHelper.TagDoubleCheck(tag, this.MinGravity);
                    }

                    //MaxGravity
                    if (tag.Contains("[MaxGravity:") == true)
                    {
                        this.MaxGravity = TagHelper.TagDoubleCheck(tag, this.MaxGravity);
                    }

                    //MinSpeed
                    if (tag.Contains("[MinSpeed:") == true)
                    {
                        this.MinSpeed = TagHelper.TagDoubleCheck(tag, this.MinSpeed);
                    }

                    //MaxSpeed
                    if (tag.Contains("[MaxSpeed:") == true)
                    {
                        this.MaxSpeed = TagHelper.TagDoubleCheck(tag, this.MaxSpeed);
                    }

                    //MinTargetValue
                    if (tag.Contains("[MinTargetValue:") == true)
                    {
                        this.MinTargetValue = TagHelper.TagFloatCheck(tag, this.MinTargetValue);
                    }

                    //MaxTargetValue
                    if (tag.Contains("[MaxTargetValue:") == true)
                    {
                        this.MaxTargetValue = TagHelper.TagFloatCheck(tag, this.MaxTargetValue);
                    }
                }
            }
        }
Ejemplo n.º 30
0
        public void InitTags(string customData)
        {
            if (string.IsNullOrWhiteSpace(customData) == false)
            {
                var descSplit = customData.Split('\n');

                foreach (var tag in descSplit)
                {
                    //UseCustomTargeting
                    if (tag.Contains("[UseCustomTargeting:") == true)
                    {
                        UseCustomTargeting = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilTargetAcquisition
                    if (tag.Contains("[TimeUntilTargetAcquisition:") == true)
                    {
                        TimeUntilTargetAcquisition = TagHelper.TagIntCheck(tag, TimeUntilTargetAcquisition);
                    }

                    //UseTargetRefresh
                    if (tag.Contains("[UseTargetRefresh:") == true)
                    {
                        UseTargetRefresh = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilNextRefresh
                    if (tag.Contains("[TimeUntilNextRefresh:") == true)
                    {
                        TimeUntilNextRefresh = TagHelper.TagIntCheck(tag, TimeUntilNextRefresh);
                    }

                    //UseTargetLastKnownPosition
                    if (tag.Contains("[UseTargetLastKnownPosition:") == true)
                    {
                        UseTargetLastKnownPosition = TagHelper.TagBoolCheck(tag);
                    }

                    //TimeUntilNextEvaluation
                    if (tag.Contains("[TimeUntilNextEvaluation:") == true)
                    {
                        TimeUntilNextEvaluation = TagHelper.TagIntCheck(tag, TimeUntilNextEvaluation);
                    }

                    //Target
                    if (tag.Contains("[Target:") == true)
                    {
                        Target = TagHelper.TagTargetTypeEnumCheck(tag);
                    }

                    //BlockTargets
                    if (tag.Contains("[BlockTargets:") == true)
                    {
                        var tempValue = TagHelper.TagBlockTargetTypesCheck(tag);

                        if (tempValue != BlockTypeEnum.None && BlockTargets.Contains(tempValue) == false)
                        {
                            BlockTargets.Add(tempValue);
                        }
                    }

                    //GetTargetBy
                    if (tag.Contains("[GetTargetBy:") == true)
                    {
                        GetTargetBy = TagHelper.TagTargetSortEnumCheck(tag);
                    }

                    //MaxDistance
                    if (tag.Contains("[MaxDistance:") == true)
                    {
                        MaxDistance = TagHelper.TagDoubleCheck(tag, MaxDistance);
                    }

                    //MatchAllFilters
                    if (tag.Contains("[MatchAllFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !MatchAllFilters.Contains(tempValue))
                        {
                            MatchAllFilters.Add(tempValue);
                        }
                    }

                    //MatchAnyFilters
                    if (tag.Contains("[MatchAnyFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !MatchAnyFilters.Contains(tempValue))
                        {
                            MatchAnyFilters.Add(tempValue);
                        }
                    }

                    //MatchNoneFilters
                    if (tag.Contains("[MatchNoneFilters:") == true)
                    {
                        var tempValue = TagHelper.TagTargetFilterEnumCheck(tag);

                        if (tempValue != TargetFilterEnum.None && !MatchNoneFilters.Contains(tempValue))
                        {
                            MatchNoneFilters.Add(tempValue);
                        }
                    }

                    //Owners
                    if (tag.Contains("[Owners:") == true)
                    {
                        var tempValue = TagHelper.TagTargetOwnerEnumCheck(tag);

                        if (!Owners.HasFlag(tempValue))
                        {
                            Owners |= tempValue;
                        }
                    }

                    //Relations
                    if (tag.Contains("[Relations:") == true)
                    {
                        var tempValue = TagHelper.TagTargetRelationEnumCheck(tag);

                        if (Relations.HasFlag(tempValue) == false)
                        {
                            Relations |= tempValue;
                        }
                    }

                    //FactionTargets
                    if (tag.Contains("[FactionTargets:") == true)
                    {
                        var tempValue = TagHelper.TagStringCheck(tag);

                        if (!string.IsNullOrWhiteSpace(tempValue) && !FactionTargets.Contains(tempValue))
                        {
                            FactionTargets.Add(tempValue);
                        }
                    }

                    //OnlyGetFromEntityOwner
                    if (tag.Contains("[OnlyGetFromEntityOwner:") == true)
                    {
                        OnlyGetFromEntityOwner = TagHelper.TagBoolCheck(tag);
                    }

                    //GetFromMinorityGridOwners
                    if (tag.Contains("[GetFromMinorityGridOwners:") == true)
                    {
                        GetFromMinorityGridOwners = TagHelper.TagBoolCheck(tag);
                    }

                    //PrioritizeSpecifiedFactions
                    if (tag.Contains("[PrioritizeSpecifiedFactions:") == true)
                    {
                        PrioritizeSpecifiedFactions = TagHelper.TagBoolCheck(tag);
                    }

                    //IsStatic
                    if (tag.Contains("[IsStatic:") == true)
                    {
                        IsStatic = TagHelper.TagCheckEnumCheck(tag);
                    }

                    //MinAltitude
                    if (tag.Contains("[MinAltitude:") == true)
                    {
                        MinAltitude = TagHelper.TagDoubleCheck(tag, MinAltitude);
                    }

                    //MaxAltitude
                    if (tag.Contains("[MaxAltitude:") == true)
                    {
                        MaxAltitude = TagHelper.TagDoubleCheck(tag, MaxAltitude);
                    }

                    //NonBroadcastVisualRange
                    if (tag.Contains("[NonBroadcastVisualRange:") == true)
                    {
                        NonBroadcastVisualRange = TagHelper.TagDoubleCheck(tag, NonBroadcastVisualRange);
                    }

                    //MinGravity
                    if (tag.Contains("[MinGravity:") == true)
                    {
                        MinGravity = TagHelper.TagDoubleCheck(tag, MinGravity);
                    }

                    //MaxGravity
                    if (tag.Contains("[MaxGravity:") == true)
                    {
                        MaxGravity = TagHelper.TagDoubleCheck(tag, MaxGravity);
                    }

                    //MinSpeed
                    if (tag.Contains("[MinSpeed:") == true)
                    {
                        MinSpeed = TagHelper.TagDoubleCheck(tag, MinSpeed);
                    }

                    //MaxSpeed
                    if (tag.Contains("[MaxSpeed:") == true)
                    {
                        MaxSpeed = TagHelper.TagDoubleCheck(tag, MaxSpeed);
                    }

                    //MinTargetValue
                    if (tag.Contains("[MinTargetValue:") == true)
                    {
                        MinTargetValue = TagHelper.TagFloatCheck(tag, MinTargetValue);
                    }

                    //MaxTargetValue
                    if (tag.Contains("[MaxTargetValue:") == true)
                    {
                        MaxTargetValue = TagHelper.TagFloatCheck(tag, MaxTargetValue);
                    }

                    //MinMovementScore
                    if (tag.Contains("[MinMovementScore:") == true)
                    {
                        MinMovementScore = TagHelper.TagFloatCheck(tag, MinMovementScore);
                    }

                    //MaxMovementScore
                    if (tag.Contains("[MaxMovementScore:") == true)
                    {
                        MaxMovementScore = TagHelper.TagFloatCheck(tag, MaxMovementScore);
                    }

                    //PrioritizePlayerControlled
                    if (tag.Contains("[PrioritizePlayerControlled:") == true)
                    {
                        PrioritizePlayerControlled = TagHelper.TagBoolCheck(tag);
                    }

                    //Names
                    if (tag.Contains("[Names:") == true)
                    {
                        var tempValue = TagHelper.TagStringCheck(tag);

                        if (!string.IsNullOrWhiteSpace(tempValue) && !Names.Contains(tempValue))
                        {
                            Names.Add(tempValue);
                        }
                    }

                    //UsePartialNameMatching
                    if (tag.Contains("[UsePartialNameMatching:") == true)
                    {
                        UsePartialNameMatching = TagHelper.TagBoolCheck(tag);
                    }

                    //MaxLineOfSight
                    if (tag.Contains("[MaxLineOfSight:") == true)
                    {
                        MaxLineOfSight = TagHelper.TagDoubleCheck(tag, MaxLineOfSight);
                    }

                    //MaxMovementDetectableDistance
                    if (tag.Contains("[MaxMovementDetectableDistance:") == true)
                    {
                        MaxMovementDetectableDistance = TagHelper.TagDoubleCheck(tag, MaxMovementDetectableDistance);
                    }

                    //BroadcastOnlyAntenna
                    if (tag.Contains("[BroadcastOnlyAntenna:") == true)
                    {
                        BroadcastOnlyAntenna = TagHelper.TagBoolCheck(tag);
                    }

                    //MinUnderWaterDepth
                    if (tag.Contains("[MinUnderWaterDepth:") == true)
                    {
                        MinUnderWaterDepth = TagHelper.TagDoubleCheck(tag, MinUnderWaterDepth);
                    }

                    //MaxUnderWaterDepth
                    if (tag.Contains("[MaxUnderWaterDepth:") == true)
                    {
                        MaxUnderWaterDepth = TagHelper.TagDoubleCheck(tag, MaxUnderWaterDepth);
                    }

                    //PlayerKnownLocationFactionOverride
                    if (tag.Contains("[PlayerKnownLocationFactionOverride:") == true)
                    {
                        PlayerKnownLocationFactionOverride = TagHelper.TagStringCheck(tag);
                    }
                }
            }
        }
Ejemplo n.º 31
0
        public TargetProfile()
        {
            UseCustomTargeting = false;

            Target       = TargetTypeEnum.None;
            BlockTargets = new List <BlockTypeEnum>();

            TimeUntilTargetAcquisition = 1;
            UseTargetRefresh           = false;
            TimeUntilNextRefresh       = 60;
            TimeUntilNextEvaluation    = 1;

            MaxDistance = 12000;

            MatchAllFilters  = new List <TargetFilterEnum>();
            MatchAnyFilters  = new List <TargetFilterEnum>();
            MatchNoneFilters = new List <TargetFilterEnum>();
            GetTargetBy      = TargetSortEnum.ClosestDistance;

            Owners         = OwnerTypeEnum.None;
            Relations      = RelationTypeEnum.None;
            FactionTargets = new List <string>();

            OnlyGetFromEntityOwner      = false;
            GetFromMinorityGridOwners   = false;
            PrioritizeSpecifiedFactions = false;

            IsStatic = CheckEnum.Ignore;

            MinAltitude = -100000;
            MaxAltitude = 100000;

            NonBroadcastVisualRange = 1500;

            MinGravity = 0;
            MaxGravity = 1.1;

            MinSpeed = 0;
            MaxSpeed = 110;

            MinTargetValue = 0;
            MaxTargetValue = 1;

            MinMovementScore = -1;
            MaxMovementScore = -1;

            MaxLineOfSight = -1;

            MaxMovementDetectableDistance = -1;

            PrioritizePlayerControlled = false;

            BroadcastOnlyAntenna = false;

            Names = new List <string>();
            UsePartialNameMatching = false;

            MinUnderWaterDepth = -1;
            MaxUnderWaterDepth = -1;

            PlayerKnownLocationFactionOverride = "";

            ProfileSubtypeId      = "";
            BuiltUniqueFilterList = false;
            AllUniqueFilters      = new List <TargetFilterEnum>();
        }