Пример #1
0
        /// <summary>
        /// Enumerates all <see cref="Region"/>s of given precision covering given area/>
        /// Current implementation only returns single region associated with area center.
        /// Under assumption of radius of area to be significantly below precision resolution and usage of extension >= 1 in search,
        /// that is enough
        /// </summary>
        /// <param name="area"><see cref="InfectionArea"/></param>
        /// <param name="precision">Precision. Any integer number</param>
        /// <returns>Collection of <see cref="Region"/>s</returns>

        public static IEnumerable<Region> GetRegionsCoverage(InfectionArea area, int precision)
        {
            yield return new Region
            {
                LatitudePrefix = PrecisionHelper.Round(area.Location.Latitude, precision),
                LongitudePrefix = PrecisionHelper.Round(area.Location.Longitude, precision),
                Precision = precision
            };
        }
Пример #2
0
    public void Cough()
    {
        //if(state != State.SNEEZING)
        {
            float coughInfection = infection;
            Infect(-1);

            GameObject    gobj          = GameObject.Instantiate(infectionAreaPrefab.gameObject) as GameObject;
            InfectionArea infectionArea = gobj.GetComponent <InfectionArea>();
            infectionArea.lifeTime  = 0.5f;
            infectionArea.infection = 1;
            infectionArea.owner     = this;
            gobj.transform.position = this.transform.position + new Vector3(0, 0.5f, 0);

            charAnimator.SetTrigger("triggerSneeze");

            SetState(State.SNEEZING);
        }
    }