Пример #1
0
    public void FixedUpdate()
    {
        float f_angle = Vector3.Angle(transform.position, m_gStormRef.transform.position);

        if (f_angle < m_fCurrentRotation)
        {
            transform.Rotate(Vector3.up * m_fRotationSpeed);
            m_fCurrentRotation -= m_fRotationSpeed;
        }
        if (f_angle > m_fCurrentRotation)
        {
            transform.Rotate(Vector3.zero * m_fRotationSpeed);
            m_fCurrentRotation += m_fRotationSpeed;
        }

        m_WindForce = m_gStormRef.GetComponent <CS_SmallStorms>().GetWindStrength();
        if (m_WindForce == WindStrength.NONE)
        {
            Motor.force = WindSpeeds[0];
        }
        if (m_WindForce == WindStrength.WEAK)
        {
            Motor.force = WindSpeeds[1];
        }
        if (m_WindForce == WindStrength.MEDIUM)
        {
            Motor.force = WindSpeeds[2];
        }
        if (m_WindForce == WindStrength.STRONG)
        {
            Motor.force = WindSpeeds[3];
        }

        Hinge.motor = Motor;
    }
Пример #2
0
    private void RandomizeWeather()
    {
        WindStrength windStrength = (WindStrength)Random.Range((int)WindStrength.Dead, (int)WindStrength.Storm + 1);
        HexDirection direction    = HexDirectionExtension.ReturnRandomDirection();

        ChangeWindDirectionAndSpeed(direction, windStrength);
    }
Пример #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Module != null ? Module.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ WindStrength.GetHashCode();
         hashCode = (hashCode * 397) ^ WindAngle.GetHashCode();
         return(hashCode);
     }
 }
Пример #4
0
        public Weather()
        {
            climate   = Climate.Temperate;
            elevation = Elevation.SeaLevel;
            season    = Season.Spring;
            precipitationIntensity = PrecipitationIntensity.Heavy;
            precipitationFrequency = PrecipitationFrequency.Intermittent;
            precipitationForm      = PrecipitationForm.RainHeavy;
            cloudCover             = CloudCover.CloudsMedium;
            windStrength           = WindStrength.Light;
            windCheckSize          = CharacterSize.None;
            windBlownAwaySize      = CharacterSize.None;
            severeWeatherEvent     = SevereWeatherEvent.None;

            inDesert      = false;
            isDay         = true;
            nightTempDrop = 0;

            RecalculateAll(true);
        }
Пример #5
0
 public void FixedUpdate()
 {
     UpdateColour();
     StormAudioHandler();
     if (m_bStormActive == true)
     {
         m_WindForce = WindStrength.STRONG;
         UpdateStorm();//Update the storm
     }
     else
     {
         m_fTimeUntilNextStorm -= Time.deltaTime;
         SetWindForce();
         if (m_fTimeUntilNextStorm <= 0)
         {
             StartRandomStorm();
             m_fTimeUntilNextStorm = Random.Range(m_vRespawnRanges.x, m_vRespawnRanges.y);
             m_fTimerMax           = m_fTimeUntilNextStorm;
         }
     }
 }
Пример #6
0
    private void SetWindForce()
    {
        float fTimePerc = (m_fTimerMax - m_fTimeUntilNextStorm) / m_fTimerMax;

        if (fTimePerc >= 0.75f)
        {
            m_WindForce = WindStrength.STRONG;
        }
        else if (fTimePerc >= 0.5f)
        {
            m_WindForce = WindStrength.MEDIUM;
        }
        else if (fTimePerc >= 0.25f)
        {
            m_WindForce = WindStrength.WEAK;
        }
        else
        {
            m_WindForce = WindStrength.NONE;
        }
    }
Пример #7
0
    private void ChangeWindDirectionAndSpeed(HexDirection newDirection, WindStrength newWindStrength)
    {
        Material ocean = Resources.Load <Material>("Materials/Water");

        ocean.DisableKeyword("_WATERDIRECTION_NE");
        ocean.DisableKeyword("_WATERDIRECTION_E");
        ocean.DisableKeyword("_WATERDIRECTION_SE");
        ocean.DisableKeyword("_WATERDIRECTION_SW");
        ocean.DisableKeyword("_WATERDIRECTION_W");
        ocean.DisableKeyword("_WATERDIRECTION_NW");

        ocean.EnableKeyword($"_WATERDIRECTION_{newDirection.ToString()}");

        ocean.SetFloat("_Speed", windSpeeds[(int)newWindStrength]);

        windStrength  = newWindStrength;
        windDirection = newDirection;
        OnWindChanged?.Invoke(newDirection, (int)newWindStrength);

        Debug.Log($"Wind is now {newWindStrength} in the {newDirection} direction");
    }
Пример #8
0
        private void SetWindStrength(bool reroll)
        {
            if (reroll)
            {
                windStrengthRoll = DiceRoller.RollD100();
            }

            if (windStrengthRoll <= 50)
            {
                windStrength = WindStrength.Light;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(0, 10);
                }
                windCheckSize         = CharacterSize.None;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = 0;
            }
            else if (windStrengthRoll >= 51 && windStrengthRoll <= 80)
            {
                windStrength = WindStrength.Moderate;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(11, 20);
                }
                windCheckSize         = CharacterSize.None;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = 0;
            }
            else if (windStrengthRoll >= 81 && windStrengthRoll <= 90)
            {
                windStrength = WindStrength.Strong;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(21, 30);
                }
                windCheckSize         = CharacterSize.Tiny;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = -2;
            }
            else if (windStrengthRoll >= 91 && windStrengthRoll <= 95)
            {
                windStrength = WindStrength.Severe;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(31, 50);
                }
                windCheckSize         = CharacterSize.Small;
                windBlownAwaySize     = CharacterSize.Tiny;
                windSkillCheckPenalty = -4;
            }
            else if (windStrengthRoll >= 96 && windStrengthRoll <= 100)
            {
                windStrength = WindStrength.Windstorm;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(51, 300);
                }
                windCheckSize         = CharacterSize.Medium;
                windBlownAwaySize     = CharacterSize.Small;
                windSkillCheckPenalty = -8;
            }
        }
Пример #9
0
 public bool Equals(IWindModule other)
 {
     return(Equals(Name, other.Name) && WindStrength.Equals(other.WindStrength) && WindAngle.Equals(other.WindAngle));
 }
Пример #10
0
 public void SetWindForce(WindStrength a_Strength)
 {
     m_WindForce = a_Strength;
 }