Ejemplo n.º 1
0
    private void UpdateWind()
    {
        // Retrieve the wind from the Flex Solver
        Flex.Params windParams = new Flex.Params();
        Flex.GetParams(container.solver, ref windParams);

        // Swap the windtype if the current windtype has exceeded its duration
        if (currentWind.HasEnded)
        {
            float lastWindSpeed = currentWind.currentSpeed;
            float lastSwivel    = currentWind.currentSwivel;
            currentWind = (currentWind.Equals(wind)) ? burstWind : wind;
            currentWind.Init(lastWindSpeed, lastSwivel);
        }

        // Update and set the wind values and rotate the flag parents to look in the right direction
        currentWind.UpdateWind();
        currentWindDirection = Quaternion.AngleAxis(currentWind.currentSwivel, Vector3.up) * windDirection;
        currentWindDirection.Normalize();
        windParams.wind   = currentWind.currentSpeed * currentWindDirection;
        windParams.wind.y = currentWind.currentSpeed / 8f; // <-- MAGIC NUMBER !!! TODO: create a function for upward wind lift.
        RotateParents();

        // Update the wind in the Flex Solver
        Flex.SetParams(container.solver, ref windParams);
    }
        /// <summary>
        /// Returns true if DisasterInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of DisasterInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DisasterInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Water == other.Water ||
                     Water != null &&
                     Water.Equals(other.Water)
                 ) &&
                 (
                     Lt == other.Lt ||
                     Lt != null &&
                     Lt.Equals(other.Lt)
                 ) &&
                 (
                     Wind == other.Wind ||
                     Wind != null &&
                     Wind.Equals(other.Wind)
                 ) &&
                 (
                     Freeze == other.Freeze ||
                     Freeze != null &&
                     Freeze.Equals(other.Freeze)
                 ) &&
                 (
                     Ht == other.Ht ||
                     Ht != null &&
                     Ht.Equals(other.Ht)
                 ) &&
                 (
                     Burn == other.Burn ||
                     Burn != null &&
                     Burn.Equals(other.Burn)
                 ));
        }