コード例 #1
0
        public void Modify_MultipliesByOneMinusChanceOfRain(int seed, int expectedValue)
        {
            Rnd.Reset(seed);
            var rain = new Rain();

            Assert.AreEqual(expectedValue, rain.Modify(100, new Choices()));
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: TimurHafizov/oopLabs
        public void TestMethod4()
        {
            Rain tran = new Rain(2, 3, 2);
            Rain rain = new Rain(3, 3, 3);

            tran = (Rain)rain.Clone();
        }
コード例 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Rain.GetHashCode() * 397) ^ (Module != null ? Module.GetHashCode() : 0));
     }
 }
コード例 #4
0
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(VersionId.Equals(other.VersionId) &&
                   LastMissionPassedName.Equals(other.LastMissionPassedName) &&
                   MissionPackGame.Equals(other.MissionPackGame) &&
                   CurrLevel.Equals(other.CurrLevel) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockMonths.Equals(other.GameClockMonths) &&
                   GameClockDays.Equals(other.GameClockDays) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   GameClockDayOfWeek.Equals(other.GameClockDayOfWeek) &&
                   StoredGameClockMonths.Equals(other.StoredGameClockMonths) &&
                   StoredGameClockDays.Equals(other.StoredGameClockDays) &&
                   StoredGameClockHours.Equals(other.StoredGameClockHours) &&
                   StoredGameClockMinutes.Equals(other.StoredGameClockMinutes) &&
                   ClockHasBeenStored.Equals(other.ClockHasBeenStored) &&
                   CurrPadMode.Equals(other.CurrPadMode) &&
                   HasPlayerCheated.Equals(other.HasPlayerCheated) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherInterpolation.Equals(other.WeatherInterpolation) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   Rain.Equals(other.Rain) &&
                   CameraCarZoomIndicator.Equals(other.CameraCarZoomIndicator) &&
                   CameraPedZoomIndicator.Equals(other.CameraPedZoomIndicator) &&
                   CurrArea.Equals(other.CurrArea) &&
                   InvertLook4Pad.Equals(other.InvertLook4Pad) &&
                   ExtraColour.Equals(other.ExtraColour) &&
                   ExtraColourOn.Equals(other.ExtraColourOn) &&
                   ExtraColourInterpolation.Equals(other.ExtraColourInterpolation) &&
                   ExtraColourWeatherType.Equals(other.ExtraColourWeatherType) &&
                   WaterConfiguration.Equals(other.WaterConfiguration) &&
                   LARiots.Equals(other.LARiots) &&
                   LARiotsNoPoliceCars.Equals(other.LARiotsNoPoliceCars) &&
                   MaximumWantedLevel.Equals(other.MaximumWantedLevel) &&
                   MaximumChaosLevel.Equals(other.MaximumChaosLevel) &&
                   GermanGame.Equals(other.GermanGame) &&
                   FrenchGame.Equals(other.FrenchGame) &&
                   NastyGame.Equals(other.NastyGame) &&
                   CinematicCamMessagesLeftToDisplay.Equals(other.CinematicCamMessagesLeftToDisplay) &&
                   TimeLastSaved.Equals(other.TimeLastSaved) &&
                   TargetMarkerHandle.Equals(other.TargetMarkerHandle) &&
                   HasDisplayedPlayerQuitEnterCarHelpText.Equals(other.HasDisplayedPlayerQuitEnterCarHelpText) &&
                   AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) &&
                   ProstiutesPayYou.Equals(other.ProstiutesPayYou));
        }
コード例 #5
0
ファイル: Raindrop.cs プロジェクト: youkaicountry/yknytt
 public void reset(Rain rain)
 {
     this.rain = rain;
     this.init = true;
     recycled  = false;
     this.SetPhysicsProcess(true);
 }
コード例 #6
0
ファイル: Events.cs プロジェクト: CrazyTiger/Test
        public Events(int level)
        {
            var rand = new Random();
            TypeEvent = rand.Next(EventsN) + 1;
            Actions = new List<Action>();

            switch (TypeEvent)
            {
                case (int)eTypeEvent.Enemy:
                    var enemy = new Enemy(level);
                    EventName = "Enemy!";
                    Event = enemy;
                    Level = enemy.Rating();
                    Actions.Add(new Action("Attack", ConsoleKey.A));
                    Actions.Add(new Action("Retreat", ConsoleKey.B));
                    break;
                case (int)eTypeEvent.Rain:
                    var rain = new Rain(level);
                    EventName = "Rain!";
                    Event = rain;
                    Level = rain.Level();
                    Actions.Add(new Action("Ok", ConsoleKey.A));
                    break;
                case (int)eTypeEvent.Chest:
                    var chest = new Chest(level);
                    EventName = "Chest!";
                    Event = chest;
                    Level = chest.Level();
                    Actions.Add(new Action("Ok", ConsoleKey.A));
                    break;
            }
        }
コード例 #7
0
ファイル: UnitTest1.cs プロジェクト: TimurHafizov/oopLabs
        public void TestMethod3()
        {
            Transport tran = new Transport();
            Rain      rain = new Rain();

            tran = (Transport)rain.Clone();
        }
コード例 #8
0
 //Add rain box
 public void AddRainBox(Rain rn)
 {
     if (!rainBoxes.Contains(rn))  //check to see if new rain object is in list
     {
         rainBoxes.Add(rn);        //Add rain object to list
     }
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     rain     = GetComponentsInChildren <Rain>(true)[0];
     fog      = GetComponentsInChildren <Fog>(true)[0];
     snow     = GetComponentsInChildren <Snow>(true)[0];
     windZone = GetComponentsInChildren <WindZone>(true)[0];
 }
コード例 #10
0
    private void Shoot_Rain()
    {
        for (int Number = 0; Number < 5; Number++)
        {
            Vector3 position = transform.position;
            if (m_h.Facing_Right == false)
            {
                position.x -= (0.9f + (Number * 1.55f));  // Place where rain begin
            }
            else
            {
                position.x += (0.9f + (Number * 1.55f));// Place where rain begin
            }
            position.y += 7f;
            Rain new_Rain = Instantiate(rain, position, rain.transform.rotation) as Rain;

            if (m_h.Facing_Right == false)
            {
                new_Rain.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
                new_Rain.Is_Right             = -3.45f;
            }
            else
            {
                new_Rain.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
                new_Rain.Is_Right             = 3.45f;
            }
        }
    }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stream"></param>
        private void LoadMetaData(Stream stream)
        {
            stream.Position = 0;
            using (var reader = new StreamReader(stream, Encoding.UTF8))
            {
                string line;
                bool   foundheader = false;
                while ((line = reader.ReadLine()) != null)
                {
                    List <String> items = new List <String>(line.Trim().Split(new string[] { " ", "\t", "," }, StringSplitOptions.RemoveEmptyEntries));
                    if (items[0] != "//")
                    {
                        if (foundheader == false)
                        {
                            //Parse the header

                            float lat;
                            float lon;
                            if (float.TryParse(items[0], out lat))
                            {
                                Latitude = lat;
                            }
                            if (float.TryParse(items[1], out lon))
                            {
                                Longitude = lon;
                            }

                            items.RemoveRange(0, 2);
                            Comments = String.Join(" ", items.ToArray());

                            foundheader = true;
                        }
                        else
                        {
                            if (items.Count() == 8)
                            {
                                var date = DateUtilities.TryParseDate(items[0]);
                                if (date != null)
                                {
                                    if (StartDate == null)
                                    {
                                        StartDate = date;
                                    }
                                    //Parse the met data
                                    EndDate = date;

                                    MaxT.Add(double.Parse(items[2]));
                                    MinT.Add(double.Parse(items[3]));
                                    Rain.Add(double.Parse(items[4]));
                                    PanEvap.Add(double.Parse(items[5]));
                                    Radiation.Add(double.Parse(items[6]));
                                    VP.Add(double.Parse(items[7]));
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #12
0
        public void ForecastMessage_IsChanceOfRain(int seed, double expectedChance)
        {
            Rnd.Reset(seed);
            var expectedMessage = String.Format("There is a {0:p0} chance of light rain, and the weather is cooler today", expectedChance);
            var rain            = new Rain();

            Assert.AreEqual(expectedMessage, rain.ForecastMessage);
        }
コード例 #13
0
ファイル: RainsController.cs プロジェクト: rodouy/IAdvisor
        public ActionResult DeleteConfirmed(long id)
        {
            Rain rain = db.Rains.Find(id);

            db.Rains.Remove(rain);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #14
0
 private void AddDrops()
 {
     for (int i = 0; i < 100; i++)
     {
         Drop d = new Drop(_random.Next(0, Form.Width), _random.Next(-200, -100), _random.Next(4, 10));
         Rain.Add(d);
     }
 }
コード例 #15
0
 public Rain AddValueInOrderOfAppearance(double value, int indexPeriod, int year = 0)
 {
     Period period = GetPeriod(indexPeriod);
     period.Year = year == 0 ? period.Year : year.ToString();
     Rain rain = new Rain() { Period = period, Quantity = value };
     ValuesInOrderOfAppearance.Add(rain);
     return rain;
 }
コード例 #16
0
 public WeatherSnapshot(Wind wind, Rain rain, Temperature temperature, Pressure pressure, Humidity humidity)
 {
     Wind        = wind;
     Rain        = rain;
     Temperature = temperature;
     Pressure    = pressure;
     Humidity    = humidity;
 }
コード例 #17
0
        public override object ToUFEEffect()
        {
            var eff = new Rain();

            eff.Amount = _Amount;
            eff.Color  = _Color.ToArgb();
            return(eff);
        }
コード例 #18
0
    //public float ParrallaxScale
    //{
    //    get
    //    {
    //        return parrallaxScale;
    //    }
    //}

    public void CheckEdge()
    {
        //check if edge is showing on right
        if (Camera.main.WorldToViewportPoint(trans.position + difVec).x < 1f && !hasRightBuddy)
        {
            //Debug.Log("made rain box on right");
            //instantiate flipped version of background on right side
            Vector3    backPos    = new Vector3(trans.position.x + (xBound * 2), trans.position.y, trans.position.z);
            GameObject rightBgObj = GameObject.Instantiate(gameObj, backPos, this.trans.rotation); //TODO: check if "gameObj should be replaced with prefab
            rightBgObj.transform.localScale = new Vector3(trans.localScale.x, trans.localScale.y, trans.localScale.z);
            hasRightBuddy          = true;
            rightRain              = new Rain(rightBgObj.transform, tiling);
            rightRain.HasLeftBuddy = true;
            rightRain.leftRain     = this;
        }
        //check if edge is showing on left
        if (Camera.main.WorldToViewportPoint(trans.position - difVec).x > 0f && !hasLeftBuddy)
        {
            //Debug.Log("made bg on left");
            //instatiate flipped version of background on left side
            Vector3    backPos   = new Vector3(trans.position.x - (xBound * 2), trans.position.y, trans.position.z);
            GameObject leftBgObj = GameObject.Instantiate(gameObj, backPos, this.trans.rotation); //TODO: check if "gameObj" should be replaced with prefab
            leftBgObj.transform.localScale = new Vector3(trans.localScale.x, trans.localScale.y, trans.localScale.z);
            hasLeftBuddy           = true;
            leftRain               = new Rain(leftBgObj.transform, tiling);
            leftRain.HasRightBuddy = true;
            leftRain.rightRain     = this;
        }


        //NOTE: this is a little off because the box is tilted and we are not finding the actual length it covers in the horizontal (ie need to find x component)
        if (Camera.main.WorldToViewportPoint(trans.position + difVec).x < 0f && hasRightBuddy)
        {
            //right is new
            tiling.AddRainBox(rightRain);
            rightRain.HasLeftBuddy = false;
            tiling.RemoveRainBox(this);
            if (leftRain != null)
            {
                GameObject.Destroy(leftRain.gameObj);
            }
            //Debug.Log("destroyed rain box on left");
            GameObject.Destroy(gameObj);
        }
        if (Camera.main.WorldToViewportPoint(trans.position - difVec).x > 1f && hasLeftBuddy)
        {
            //left is new
            tiling.AddRainBox(leftRain);
            leftRain.HasRightBuddy = false;
            tiling.RemoveRainBox(this);
            if (rightRain != null)
            {
                GameObject.Destroy(rightRain.gameObj);
            }
            //Debug.Log("destroyed rain box on right");
            GameObject.Destroy(gameObj);
        }
    }
コード例 #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tempF">int</param>
 /// <param name="wind">Wind</param>
 /// <param name="rain">Rain</param>
 /// <param name="snow">Snow</param>
 /// <param name="fog">Fog</param>
 public Weather(int tempF, Wind wind, Rain rain, Snow snow, Fog fog)
 {
     this.tempF = tempF;
     this.tempC = ConvertFToC();
     this.wind  = wind;
     this.rain  = rain;
     this.snow  = snow;
     this.fog   = fog;
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: zachwangfsqm/CSharpCourse
        static void Main(string[] args)
        {
            Rain        rain    = new Rain(30);
            detail_rain dt_rain = new detail_rain();

            dt_rain.RainEvent += rain.say_amount;
            dt_rain.RainEvent += rain.say_time;
            dt_rain.startRain();
        }
コード例 #21
0
        //-------------------------------------------------------------------------
        // Load, Unload

        public static void Load(System.Action pre, System.Action done)
        {
            Rain.Load(pre, done);
            Thunder.Load(pre, done);
            Ice.Load(pre, done);
            Leaves.Load(pre, done);
            Ghost.Load(pre, done);
            Twinkle.Load(pre, done);
            Spark.Load(pre, done);
        }
コード例 #22
0
 public RainViewModel(Rain pRain)
 {
     this.WaterInputId            = pRain.WaterInputId;
     this.Type                    = pRain.Type;
     this.Date                    = pRain.Date;
     this.Input                   = pRain.Input;
     this.ExtraDate               = pRain.ExtraDate;
     this.ExtraInput              = pRain.ExtraInput;
     this.CropIrrigationWeatherId = pRain.CropIrrigationWeatherId;
 }
コード例 #23
0
ファイル: RainsController.cs プロジェクト: rodouy/IAdvisor
 public ActionResult Edit([Bind(Include = "WaterInputId,Type,Input,Date,ExtraInput,ExtraDate")] Rain rain)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rain).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rain));
 }
コード例 #24
0
 public static void Unload()
 {
     Rain.Unload();
     Thunder.Unload();
     Ice.Unload();
     Leaves.Unload();
     Ghost.Unload();
     Twinkle.Unload();
     Spark.Unload();
 }
コード例 #25
0
ファイル: RainFactory.cs プロジェクト: morgash1989/Lemma
        public override void Bind(Entity entity, Main main, bool creating = false)
        {
            entity.CannotSuspendByDistance = true;
            Transform transform = entity.GetOrCreate <Transform>("Transform");

            Rain rain = entity.GetOrCreate <Rain>("Rain");

            ParticleEmitter emitter = entity.GetOrCreate <ParticleEmitter>("Emitter");

            emitter.Add(new Binding <Vector3>(emitter.Jitter, rain.Jitter));

            Components.DirectionalLight lightning = entity.GetOrCreate <Components.DirectionalLight>("Lightning");
            lightning.Serialize = false;
            lightning.Add(new Binding <Quaternion>(lightning.Quaternion, transform.Quaternion));
            lightning.Add(new Binding <bool>(lightning.Shadowed, rain.LightningShadowed));
            lightning.Enabled.Value = false;

            lightning.Add(new TwoWayBinding <Vector3>(rain.CurrentLightningColor, lightning.Color));

            if (!main.EditorEnabled)
            {
                lightning.Add(new Binding <bool>(lightning.Enabled, rain.LightningEnabled));
            }

            emitter.AddParticle = delegate(Vector3 position, Vector3 velocity, float prime)
            {
                Vector3 kernelCoord = (position - rain.KernelOffset) / Rain.KernelSpacing;
                float   height      = rain.RaycastHeights[Math.Max(0, Math.Min(Rain.KernelSize - 1, (int)kernelCoord.X)), Math.Max(0, Math.Min(Rain.KernelSize - 1, (int)kernelCoord.Z))];
                if (height < position.Y)
                {
                    emitter.ParticleSystem.AddParticle(position, Vector3.Zero, Math.Min((position.Y - height) / Rain.VerticalSpeed, Rain.MaxLifetime), -1.0f, prime);
                }
            };

            emitter.Add(new Binding <Vector3>(emitter.Position, x => x + new Vector3(0.0f, Rain.StartHeight, 0.0f), main.Camera.Position));

            this.SetMain(entity, main);
            emitter.ParticleType.Value = "Rain";

            entity.Add("ThunderIntervalMin", rain.ThunderIntervalMin);
            entity.Add("ThunderIntervalMax", rain.ThunderIntervalMax);
            entity.Add("ThunderMaxDelay", rain.ThunderMaxDelay);
            entity.Add("ParticlesPerSecond", emitter.ParticlesPerSecond);
            entity.Add("LightningShadowed", rain.LightningShadowed);
            entity.Add("LightningColor", rain.LightningColor);

            entity.Add(new PostInitialization
            {
                delegate()
                {
                    rain.Update();
                    emitter.Prime(Vector3.Zero);
                }
            });
        }
コード例 #26
0
 public ViewDitailsViewModel(Rain rain, Wind wind, Clouds clouds, Weather[] weather, Main main)
 {
     OnClickedBackCommand = new Command(async() =>
     {
         await Application.Current.MainPage.Navigation.PopModalAsync();
     });
     WindSpeed   = wind.speed.ToString();
     Pressure    = main.pressure.ToString();
     HumidityTxt = main.humidity.ToString();
     Rainfall    = (rain == null) ? "No rain" : rain._3h.ToString();
 }
コード例 #27
0
    public Rain DatRainHelper;   //used to see if its raining in order to water



    // Use this for initialization
    void Start()
    {
        /*
         * var c = GameObject("Crop");
         * Vector3 turn = c.Collider.bounds.center;
         * c.RotateAround(turn);
         */


        this.DatRainHelper = (Rain)Object.FindObjectOfType(typeof(Rain));
    }
コード例 #28
0
ファイル: RainsController.cs プロジェクト: rodouy/IAdvisor
        public ActionResult Create([Bind(Include = "WaterInputId,Type,Input,Date,ExtraInput,ExtraDate")] Rain rain)
        {
            if (ModelState.IsValid)
            {
                db.Rains.Add(rain);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rain));
        }
コード例 #29
0
 //Remove rain box
 public void RemoveRainBox(Rain rn)
 {
     //Debug.Log("remove bg. bgs.size = " + backgrounds.Count);
     if (rainBoxes.Contains(rn))                                     //Check to see if rain object is in list
     {
         rainBoxes.Remove(rn);                                       //Remove rain object from list
     }
     else                                                            //Trying to remove rain object that is not in list
     {
         Debug.Log("Background " + rn.Trans.name + " not found in backgrounds, but you are trying to remove it.");
     }
 }
コード例 #30
0
 IEnumerator MakeRain()
 {
     while (true)
     {
         Rain  rai = Util.InstantiateComponent <Rain>(rain, this.transform);
         float x   = Random.Range(-460.0f, 460.0f);
         RainSize = Random.Range(50.0f, 160.0f);
         rai.transform.localPosition = new Vector3(x, 500.0f);
         rai.transform.localScale    = new Vector3(RainSize, RainSize);
         yield return(new WaitForSeconds(GameLevel));
     }
 }
コード例 #31
0
ファイル: Rain.cs プロジェクト: abogilovic/still-burning
 void Awake()
 {
     if (s_inst == null)
     {
         s_inst = this;
     }
     else
     {
         Destroy(s_inst);
         s_inst = this;
     }
 }
コード例 #32
0
 // Start is called before the first frame update
 void Start()
 {
     // テキスト読み込み
     SheetToDictionary.Instance.TextToDictionary("Rain", out var textDataDic);
     // データ代入
     maxAlpha = textDataDic["雨が降った際の空の黒さの最大値(0~255)"];
     // コンポーネント取得
     sprite       = GetComponent <SpriteRenderer>();
     rain         = transform.root.transform.Find("Rain").GetComponent <Rain>();
     increaseTime = rain.increaseTime;
     decreaseTime = rain.decreaseTime;
 }
コード例 #33
0
ファイル: WeatherForecast.cs プロジェクト: vebin/soa
 public WeatherInfo(DateTime date, TemperatureUnit unit, int temperatureLow, int temperatureHi, Cloudiness cloudiness,
     Rain rain, bool snow, bool fog, bool hail) {
     if(temperatureHi < temperatureLow)
         throw new ArgumentException("temperatureHi < temperatureLow");
     this.date = date;
     this.temperatureLow = new Temperature(temperatureLow, unit);
     this.temperatureHi = new Temperature(temperatureHi, unit);
     this.cloudiness = cloudiness;
     this.rain = rain;
     this.snow = snow;
     this.fog = fog;
     this.hail = hail;
 }
コード例 #34
0
ファイル: WeatherForecast.cs プロジェクト: vebin/soa
 private bool GetRandomHail(Rain rain) {
     double fraction = random.NextDouble();
     switch(rain) {
         case Rain.Thunderstorm:
             return fraction < 0.5;
         case Rain.Heavy:
             return fraction < 0.1;
         case Rain.Drizzle:
             return fraction < 0.03;
         default:
             return false;
     }
 }