Example #1
0
        /// <summary>
        /// Configures this instance.
        /// </summary>
        /// <param name="area">The area.</param>
        /// <param name="damage">The damage.</param>
        /// <param name="targets">The targets.</param>
        /// <param name="owner">The owner.</param>
        /// <exception cref="ArgumentOutOfRangeException">damage - Must be greater than 0.</exception>
        /// <exception cref="ArgumentNullException">
        /// targets
        /// or
        /// owner
        /// </exception>
        public void Setup(AreaTarget area, float damage, ITargetsProvider targets, ITeamMember owner)
        {
            if (area == null)
            {
                DestroyAsPoolableObject();
                return;
            }

            if (damage <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(damage), "Must be greater than 0.");
            }

            this.area    = area;
            this.damage  = damage;
            this.targets = targets ?? throw new ArgumentNullException(nameof(targets));
            this.owner   = owner ?? throw new ArgumentNullException(nameof(owner));

            meteorPaticles.transform.position = new Vector3(area.Position.x, DEFAULT_Y_POSITION, area.Position.z);
            meteorPaticles.transform.rotation = Quaternion.Euler(DEFAULT_ROTATION);

            var shape = meteorPaticles.shape;

            shape.angle  = 0;
            shape.radius = area.Radius;

            StartCoroutine(DealingDamage());
        }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        sceneId = Application.loadedLevelName;
        Debug.LogWarning("当前场景:" + Application.loadedLevelName);
        //每次切换新的区域大地图都需要把静态事件和动态事件合并
        if (StaticAreaEventsMapping == null)
        {
            StaticAreaEventsMapping = new System.Collections.Generic.Dictionary <string, EventData>();
            JObject allEvents = JsonManager.GetInstance().GetJson("AreaEventDatas");
            foreach (var obj in allEvents)
            {
                if (!StaticAreaEventsMapping.ContainsKey(obj.Value["Id"].ToString()))
                {
                    StaticAreaEventsMapping.Add(obj.Value["Id"].ToString(), JsonManager.GetInstance().DeserializeObject <EventData>(obj.Value.ToString()));
                }
            }
        }
        //加载动态事件
        if (ActiveAreaEventsMapping == null)
        {
            ActiveAreaEventsMapping = new Dictionary <string, EventData>();
        }

        //初始化临时禁用事件集合
        if (DisableEventIdMapping == null)
        {
            DisableEventIdMapping = new Dictionary <string, EventData>();
        }

        follow             = GetComponent <tk2dTileMapDemoFollowCam>();
        follow.followSpeed = 30;
        map                  = GameObject.Find("TileMap").GetComponent <tk2dTileMap>();
        areaTarget           = Statics.GetPrefabClone("Prefabs/AreaTarget").GetComponent <AreaTarget>();
        areaTarget.Map       = map;
        follow.target        = areaTarget.transform;
        myCamera             = GetComponent <Camera>();
        myCamera.cullingMask = 1 << LayerMask.NameToLayer("Role") | 1 << LayerMask.NameToLayer("Ground") | 1 << LayerMask.NameToLayer("Target");
        myBeatuify           = GetComponent <Beautify>();
        if (myBeatuify == null)
        {
            myBeatuify = gameObject.AddComponent <Beautify>();
        }
        myBeatuify.quality           = BEAUTIFY_QUALITY.Mobile;
        myBeatuify.preset            = BEAUTIFY_PRESET.Medium;
        myBeatuify.sharpenRelaxation = 0;
        myBeatuify.brightness        = 1f;
    }
        //protected override bool ValidateFileHeader(string fileHeader, FileProgress fileProgress, out string errorMessage)
        //{
        //    if (HeaderLineV6.ToUpper().EqualsIgnoreCase(fileHeader.Trim().ToUpper()))
        //    {
        //        errorMessage = string.Format("The input file [{0}] does not appear to be of the correct file type.", fileProgress.FileName) + "\n\n" +
        //                                     "If you are trying to import the reports genrated by AHRQ QI v6.0 ICD-10 version, please note that MONAHRQ will not be able to process the file and can't import it at this time.";
        //        return false;
        //    }

        //    return base.ValidateFileHeader(fileHeader, fileProgress, out errorMessage);
        //}

        // This processes a single line for AREA files
        // TODO: since this saves 1 line at a time to SQL, we should set up NH to use batches
        /// <summary>
        /// Lines the function.
        /// </summary>
        /// <param name="inputLine">The input line.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">
        /// Empty line !
        /// or
        /// Measure code length can't must be greater than zero
        /// </exception>
        public bool LineFunction(string inputLine)
        {
            if (string.IsNullOrEmpty(inputLine))
            {
                throw new Exception("Empty line !");
            }

            // In the main import of the rows.
            var cols        = Enumerable.ToList(inputLine.Split(new[] { "," }, StringSplitOptions.None));
            var columnCount = cols.Count;

            // Process if it's not a blank line.
            var measureCodeModule = cols[0].Trim();
            var measureCodeNumb   = cols[1].Trim();

            if (!string.IsNullOrEmpty(measureCodeNumb) && measureCodeNumb.Length == 1)
            {
                measureCodeNumb = measureCodeNumb.PadLeft(2, '0');
            }

            var measureCode = string.Format("{0} {1}", measureCodeModule, measureCodeNumb.Trim());

            if (measureCode.Length == 0)
            {
                throw new Exception("Measure code length can't must be greater than zero");
            }
            // Make sure it's not a total row

            var col2Val          = cols[2].Trim();
            var isStratification = col2Val.Equals("TOTAL");

            var areaTarget = new AreaTarget
            {
                Dataset             = DataContextObject.DatasetItem,
                MeasureCode         = measureCode,
                Stratification      = isStratification ? "AVG" : string.Empty,
                CountyFIPS          = isStratification ? string.Empty : col2Val,
                ObservedNumerator   = GetIntFromString(cols[3]),
                ObservedDenominator = GetIntFromString(cols[4]),
                ObservedRate        = GetDecimalFromString(cols[5]),
                ObservedCILow       = GetDecimalFromString(columnCount == 15 ? cols[6] : null),
                ObservedCIHigh      = GetDecimalFromString(columnCount == 15 ? cols[7] : null),
                ExpectedRate        = GetDecimalFromString(columnCount == 13 ? cols[6] : cols[8]),
                RiskAdjustedRate    = GetDecimalFromString(columnCount == 13 ? cols[9] : cols[11]),
                RiskAdjustedCILow   = GetDecimalFromString(columnCount == 13 ? cols[10] : cols[12]),
                RiskAdjustedCIHigh  = GetDecimalFromString(columnCount == 13 ? cols[11] : cols[13])
            };

            // Check for total costs column.
            //decimal? totalCost = 0;
            //if (columnCount >= 16)
            //{
            //    totalCost = GetDecimalFromString(cols[15]) ?? 0M;
            //}
            //areaTarget.TotalCost = totalCost == 0M ? null : totalCost;

            if (AnyCounty <AreaTarget>(measureCode, areaTarget.CountyFIPS ?? "AVG", areaTarget.Dataset.Id))
            {
                return(false);
            }

            Insert(areaTarget);
            return(true);
        }
Example #4
0
        public IEnumerable <string> GetEntitesInArea(AreaTarget area)
        {
            var inArea = m_Entities.Where(a => area.IsEntityInArea(a.Value));

            return(inArea.Select(a => a.Value.Name));
        }
Example #5
0
        /// <summary>
        /// Creates the meteor shower - helper-object that spawns meteorites in a given area and deals damage to enemies.
        /// </summary>
        /// <param name="owner">The skill owner (caster).</param>
        /// <param name="targetsProvider">The targets provider.</param>
        /// <param name="target">The target.</param>
        /// <param name="skillLevel">The skill level.</param>
        /// <param name="objectsPool">The objects pool.</param>
        /// <exception cref="ArgumentNullException">
        /// owner
        /// or
        /// targetsProvider
        /// or
        /// target
        /// or
        /// objectsPool
        /// </exception>
        public void CreateMeteorShower(ISkilled owner, ITargetsProvider targetsProvider, AreaTarget target, int skillLevel,
                                       IObjectsPool objectsPool)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            if (targetsProvider == null)
            {
                throw new ArgumentNullException(nameof(targetsProvider));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            if (objectsPool == null)
            {
                throw new ArgumentNullException(nameof(objectsPool));
            }

            var parameters = GetParameters(skillLevel);
            var meteor     = objectsPool.GetOrCreate(parameters.MeteorShowerPrefab);

            meteor.Setup(target, parameters.Damage, targetsProvider, owner);
        }