Summary description for Rabbit
Beispiel #1
0
    public float calc_Fox_Runge_Kutta(float f, float r, float ts)
    {
        Rabbit rab = new Rabbit();
        Fox fx = new Fox();

        float k1 = 0;
        float k2 = 0;
        float k3 = 0;
        float k4 = 0;

        float n1 = 0;
        float n2 = 0;
        float n3 = 0;

        k1 = fx.fox_model(f, r); //f(y)
        n1 = rab.rabbit_model(r, f);
        float tmp = f + (ts / 2) * k1;
        float tmp2 = r + (ts / 2) * n1;

        k2 = fx.fox_model((tmp), tmp2); //f(y+(h/2)k1)
        n2 = rab.rabbit_model(tmp2, tmp);
        tmp = f + (ts / 2) * k2;
        tmp2 = r + (ts / 2) * n2;

        k3 = fx.fox_model((tmp), tmp2); //f(y+(h/2)k2)
        n3 = rab.rabbit_model(tmp2, tmp);
        tmp = f + ts * k3;
        tmp2 = r + (ts / 2) * n3;

        k4 = fx.fox_model((tmp), tmp2); //f(y+ hk3)

        f = f + ts * (k1 + 2 * k2 + 2 * k3 + k4) / 6; //y + h*(k1 + 2 * k2 + 2 * k3 + k4)/6
        return f;
    }
 public void RabbitMq(int messageSize, long numberOfMessages)
 {
     using (var rabbitMq = new Rabbit())
     {
         new ShootoutTest(rabbitMq, rabbitMq).Run(messageSize, numberOfMessages);
     }
 }
        static void CombineVariances()
        {
            ReturnOneAnimal pickGiraffe = new ReturnOneAnimal(ReturnGiraffe);

            Giraffe giraffe = new Giraffe();
            Rabbit rabbit = new Rabbit();
            pickGiraffe(rabbit, giraffe);
        }
Beispiel #4
0
    private void OnTriggerEnter(Collider collider)
    {
        Rabbit rabbit = collider.GetComponent <Rabbit>();

        if (rabbit)
        {
            IsTouch = true;
        }
    }
        public void SetUp()
        {
            _livesMock = Substitute.For <ILivesComponent>();
            var statsMock = Substitute.For <IRabbitStats>();

            _mockedDependenciesRabbit = new Rabbit(_livesMock, statsMock);
            InitRabbit();
            InitOrc();
        }
        public void RabbitMq()
        {
            const long numberOfMessages = 1000000;

            using (var rabbitMq = new Rabbit())
            {
                new ShootoutTest(rabbitMq, rabbitMq).Run(1000, numberOfMessages);
            }
        }
Beispiel #7
0
    private void OnTriggerExit(Collider collider)
    {
        Rabbit rabbit = collider.GetComponent <Rabbit>();

        if (rabbit)
        {
            IsTouch = false;
        }
    }
Beispiel #8
0
    public override void GetFood(Rabbit _raabit)
    {
        _raabit.GetFood(satiety);

        FoodManager.GetInstance.PushPoolObject(foodType, this.gameObject);
        FoodManager.GetInstance.field_Foods.Remove(this.gameObject);

        this.gameObject.SetActive(false);
    }
Beispiel #9
0
    private void OnTriggerEnter(Collider collider)
    {
        Rabbit rabbit = collider.GetComponent <Rabbit>();

        if (rabbit && !IsTouch)
        {
            IsTouch = true;
            _teleportController.TeleportEvent.Invoke();
        }
    }
Beispiel #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            Rabbit   rabbit   = new Rabbit();
            Tortoise tortoise = new Tortoise();
            Thread   t1       = new Thread(() => rabbit.Run(this.richTextBox1));
            Thread   t2       = new Thread(() => tortoise.Run(this.richTextBox2));

            t1.Start();
            t2.Start();
        }
Beispiel #11
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Rabbit rabit = collider.GetComponent <Rabbit>();

        if (rabit != null)
        {
            rabit.dieSoundPLay();
            LevelController.current.onRabitDeath(rabit);
        }
    }
        public void Demonstrate()
        {
            Animal cat    = new Cat();
            Animal rabbit = new Rabbit();
            Animal dog    = new Dog();

            System.Console.WriteLine(cat.Name);
            System.Console.WriteLine(rabbit.Name);
            System.Console.WriteLine(dog.Name);
        }
Beispiel #13
0
        static void BrokenCovariance()
        {
            // An example showing how the covariance is broken wrt
            // Arrays in C#
            Animal[] animals = new Giraffe[10];

            // Although the below code doesn't throw a compile time error, it will
            // fail at runtime because Rabbit != Giraffe
            animals[4] = new Rabbit();
        }
Beispiel #14
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Rabbit rab = collision.GetComponent <Rabbit>();

        if (rab != null)
        {
            rab.hitted();
            Destroy(this.gameObject);
        }
    }
        static void MethodParamContravariance()
        {
            UseSpecificAnimals useSpecificAnimals = new UseSpecificAnimals(UseUnspecificAnimals);

            // While the delegate can accept the method which less derived params,
            // the method itself requires that correct objects are passed.
            Giraffe giraffe = new Giraffe();
            Rabbit rabbit = new Rabbit();
            useSpecificAnimals(giraffe, rabbit);
        }
 public IActionResult Post([FromBody] Rabbit model)
 {
     if (ModelState.IsValid)
     {
         //save in 'database'
         myRabbits.Add(model);
         return(Ok());
     }
     return(BadRequest());
 }
Beispiel #17
0
    protected override void OnRabitHit(Rabbit rabit)
    {
        if (!LevelController.current.getFruitsCMPX().Contains(int.Parse(this.transform.name)))
        {
            LevelController.current.getFruitsCMPX().Add(int.Parse(this.transform.name));
        }

        LevelController.current.addFruit();
        this.CollectedHide();
    }
Beispiel #18
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Rabbit rabbit = collider.GetComponent <Rabbit> ();

        if (rabbit != null)
        {
            LevelController.current.OnRabbitDeath(rabbit);
            rabbit.GetComponent <Animator> ().SetTrigger("die");
        }
    }
Beispiel #19
0
        public void GetRabbitAge()
        {
            var animal = new Rabbit {
                Name = "rabbit1", AgeInHumanYears = 3
            };
            var expected = 60;
            var actual   = animal.AgeInRabbitYears;

            Assert.AreEqual(expected, actual);
        }
Beispiel #20
0
        // todo:
        public void Mutation(ref Rabbit children)
        {
            var item1 = Rand.Next(_dnaElementsCount);

            children.Dna.Gene[item1] = Rand.Next(RandomMaxValue);

            var item2 = Rand.Next(_dnaElementsCount);

            children.Dna.Gene[item2] = Rand.Next(RandomMaxValue);
        }
Beispiel #21
0
 public void InitializeRabbitTest()
 {
     mockChannel.Setup(c => c.CreateBasicProperties()).Returns(mockProperties.Object);
     mockChannel.Setup(c => c.IsClosed).Returns(true);
     mockChannel.Setup(c => c.IsClosed).Returns(false);
     mockConnection.Setup(c => c.CreateModel()).Returns(mockChannel.Object);
     mockConnection.Setup(c => c.IsOpen).Returns(true);
     mockFactory.Setup(f => f.CreateConnection()).Returns(mockConnection.Object);
     subject = new Rabbit(mockFactory.Object, null, false, expectedPrefetch);
 }
        /// <summary>
        /// Adds the rabbit.
        /// </summary>
        public void AddRabbit()
        {
            Rabbit newRabbit = new Rabbit(this.initialRabbitPosition, 0.75f);
            this.Owner.AddChild(newRabbit.Entity);
            this.rabbits.Add(newRabbit);

            this.lastRabbit = newRabbit;

            this.NotifyNewScore();
        }
Beispiel #23
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        Rabbit rabit = collision.gameObject.GetComponent <Rabbit>();

        if (rabit != null)
        {
            hit(rabit);
            rabit.hitted();
        }
    }
Beispiel #24
0
    override public PlayerBase ProducePlayer()
    {
        var player = base.ProducePlayer();

        if (player == null)
        {
            player = new Rabbit();
        }
        return(player);
    }
Beispiel #25
0
 private void Reset()
 {
     this.turtle          = new Turtle(4, 3);
     this.rabbit          = new Rabbit(15, 5);
     turtleLabel.Left     = 12;
     rabbitLabel.Left     = 12;
     startButton.Enabled  = true;
     turtleButton.Enabled = true;
     rabbitButton.Enabled = true;
     timer1.Stop();
 }
        /// <summary>
        /// Adds the rabbit.
        /// </summary>
        public void AddRabbit()
        {
            Rabbit newRabbit = new Rabbit(this.initialRabbitPosition, 0.75f);

            this.Owner.AddChild(newRabbit.Entity);
            this.rabbits.Add(newRabbit);

            this.lastRabbit = newRabbit;

            this.NotifyNewScore();
        }
    public bool AllowOccupant(Rabbit requester)
    {
        if (occupied)
        {
            return(false);
        }
        occupant = requester;
        occupied = true;

        return(true);
    }
Beispiel #28
0
        private void ShowEffect(Point3D p, Map map)
        {
            Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
            int z = Utility.Random(3) + 3;

            for (int x = 0; x < z; x++)
            {
                BaseCreature rabbit = new Rabbit();
                rabbit.MoveToWorld(p, map);
            }
        }
Beispiel #29
0
        private static KeyValuePair <int, double> GetChartPoint(Rabbit rabbit)
        {
            var binary = string.Empty;

            for (int i = 0; i < 4; i++)
            {
                binary += Convert.ToString(rabbit.Dna.Gene[i], 2);
            }

            return(new KeyValuePair <int, double>(Convert.ToInt32(binary, 2), Math.Round(rabbit.Fitness, 2)));
        }
Beispiel #30
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Rabbit  rabit    = collider.GetComponent <Rabbit>();
        Vector3 r_pos    = rabit.transform.localPosition;
        Vector3 this_pos = transform.parent.localPosition;

        if (rabit != null && this_pos.y < r_pos.y && !rabit.isDead())
        {
            orc.die();
        }
    }
Beispiel #31
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (!this.hideAnimation)
     {
         Rabbit rabbit = collider.GetComponent <Rabbit>();
         if (rabbit != null)
         {
             this.OnRabbitHit(rabbit);
         }
     }
 }
Beispiel #32
0
 public ActionResult Edit([Bind(Include = "RabbitID,Owner,Age")] Rabbit rabbit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rabbit).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Owner = new SelectList(db.Owners, "OwnerID", "Name", rabbit.Owner);
     return(View(rabbit));
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (!_hideAnimation)
     {
         Rabbit rabit = other.GetComponent <Rabbit>();
         if (rabit != null)
         {
             OnRabitHit(rabit);
         }
     }
 }
Beispiel #34
0
 void OnTriggerStay(Collider other)
 {
     if (!targetRabbit)
     {
         if (other.gameObject.CompareTag("rabbit") && !other.isTrigger)
         {
             targetRabbit = other.gameObject.GetComponent <Rabbit>();
             state        = WolfState.Hunting;
         }
     }
 }
Beispiel #35
0
 float getRabbitDirection(Rabbit rabbit)
 {
     if (rabbit.transform.position.x < this.transform.position.x)
     {
         return(1);
     }
     else
     {
         return(-1);
     }
 }
        public void GetNumberOfCatsInShelterTest()
        {
            var    shelter = new ShelterRepository(1);
            Rabbit rabbit  = new Rabbit {
                Name = "rabbit", AgeInHumanYears = 2
            };
            //shelter.AddAnimal(rabbit);
            var expected = 0;
            var actual   = shelter.GetNumberOfCatsInShelter();

            Assert.AreEqual(expected, actual);
        }
Beispiel #37
0
 protected override void OnRabitHit(Rabbit rabbit)
 {
     if (rabbit.IsBig())
     {
         rabbit.MakeNormalScale();
     }
     else
     {
         LevelController.current.OnRabbitDeath(rabbit);
     }
     this.CollectedHide();
 }
Beispiel #38
0
    public float calc_Rabbit_Runge_Kutta(float r, float f, float ts)
    {
        Rabbit rab = new Rabbit();
        Fox fx = new Fox();

        float k1 = 0;
        float k2 = 0;
        float k3 = 0;
        float k4 = 0;

        float m1 = 0;
        float m2 = 0;
        float m3 = 0;

        //k1 = rproxy.pop_inc(r, f); //f(y)
        k1 = rab.rabbit_model(r, f);
        m1 = fx.fox_model(f, r);
        float tmp = r + (ts / 2) * k1;
        float tmp2 = f + (ts / 2) * m1;

        //k2 = rproxy.pop_inc((tmp), f); //f(y+(h/2)k1)
        k2 = rab.rabbit_model((tmp), tmp2);
        m2 = fx.fox_model((tmp2), tmp);
        tmp = r + (ts / 2) * k2;
        tmp2 = f + (ts / 2) * m2;

        //k3 = rproxy.pop_inc((tmp), f); //f(y+(h/2)k2)
        k3 = rab.rabbit_model((tmp), tmp2);
        m3 = fx.fox_model((tmp2), tmp);
        tmp = r + ts * k3;
        tmp2 = f + ts * m3;

        //k4 = rproxy.pop_inc((tmp), f); //f(y+ hk3)
        k4 = rab.rabbit_model((tmp), tmp2);

        //y + h*(k1 + 2 * k2 + 2 * k3 + k4)/6
        r = r + ts * (k1 + 2 * k2 + 2 * k3 + k4) / 6;
        return r;
    }
        /// <summary>
        /// Creates the explosion.
        /// </summary>
        /// <param name="rabbit1">The rabbit1.</param>
        private void CreateExplosion(Rabbit rabbit1)
        {
            Vector2 explosionPosition = new Vector2(rabbit1.Transform2D.X, rabbit1.Transform2D.Y);
            this.explosionTransform.X = explosionPosition.X;
            this.explosionTransform.Y = explosionPosition.Y;

            this.explosionSystem.Emit = true;
            WaveServices.TimerFactory.CreateTimer("explosionTimer", TimeSpan.FromSeconds(1), () =>
            {
                this.explosionSystem.Emit = false;
            }, false);

            SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Explosion);
        }
Beispiel #40
0
 public void createRabbit(int x, int y)
 {
     Rabbit tempRabbit = new Rabbit(this, x, y);
     if (fields[x, y].animal == null)
     {
         animalList.Add(tempRabbit);
         fields[x, y].animal = tempRabbit;
     }
 }
	public void Start()
	{
	    _rabbitComponent = transform.parent.GetComponent<Rabbit>();
	}
    public double[,] rabbit_fox_horizontal_diff_ts(float r, float r_ts, float f, float f_ts, int yr, string r_integ_method, string f_integ_method)
    {
        int ts_factor = 10; //time step factor, to define numer of loops in unit of time, e.g. if ts=0.1 then we will have 10 loops in each unit of time

        float ts;
        if (r_ts > f_ts)
            ts = f_ts;
        else if (r_ts > f_ts)
            ts = r_ts;
        else
            ts = r_ts;

        if (ts >= 0.1)
        {
            ts_factor = 10;
        }
        else if (ts >= 0.009) //>=0.01
        {
            ts_factor = 100;
        }
        else if (ts >= 0.0009) //>=0.001
            ts_factor = 1000;

        //ts_factor = 1000;

        Rabbit rab = new Rabbit();
        Fox fx_m = new Fox();

        RungeKutta rk = new RungeKutta();

        //the system will loop for each time step
        //int lp = Convert.ToInt32(Math.Truncate(yr / 0.1)); //total number of loop due to the defined year
        int lp = yr * ts_factor;

        lp = lp + 1;
           // r_result = new double[lp]; //array for rab
        //f_result = new double[lp]; //array for fox

        double[,] result = new double[lp, 2];

        double[] t = new double[3];
        t[1] = Convert.ToDouble(r_ts.ToString("#.####")); //time step of rabbit
        t[2] = Convert.ToDouble(f_ts.ToString("#.####")); //time step of fox

        int temp_r_ts = Convert.ToInt16(r_ts * ts_factor);
        int temp_f_ts = Convert.ToInt16(f_ts * ts_factor);

        float rx = r;
        float ry = f;
        float fx = r;
        float fy = f;

        for (int i = 1; i < lp; i++)
        {

            int m = i % temp_r_ts; //m for maintaining result of % operation
            if (m == 0 && i > 0) //check if the current time step is valid to run rabit model
            {

                if (r_integ_method == "Runge-Kutta") // Runge-Kutta integration of rabbit model
                {
                    rx = rk.calc_Rabbit_Runge_Kutta(rx, ry, r_ts);

                }
                else
                    rx = rx + rab.rabbit_model(rx, ry) * r_ts;
                //rx = rx + rabbit_with_diff_func(rx, ry) * r_ts;

                r = rx;
            }

            int n = i % temp_f_ts;
            if (n == 0 && i > 0) //check if the current time step is valid to run fox model
            {
                if (m == 0)
                    fx = r;

                if (f_integ_method == "Runge-Kutta") // for Runge-Kutta integration of fox model
                {
                    fy = rk.calc_Fox_Runge_Kutta(fy, fx, f_ts);
                }
                else
                    fy = fy + fx_m.fox_model(fy, fx) * f_ts;
                //fy = fy + fox_with_diff_func(fy, fx) * f_ts;

                f = fy;
                fx = r;
            }

            if (m == 0) //if the time step meets ts of rabbit then copy value of f
                ry = f;

            //r_result[i] = r; // Convert.ToDouble(r.ToString("#.##"));
            result[i,0] = r;

            if (f >= 0)
                //f_result[i] = f;
                result[i, 1] = f;
            else //if fox pop <0 set it to 0
            {
                f = 0;
                //f_result[i] = 0;
                result[i, 1] = 0;
            }

            if (result[i, 0] < 0) // (r_result[i] < 0)
            {
                //r_result[i] = 0;//if rab pop<0 then set the pop value to 0 and quit
                //f_result[i] = 0;
                result[i, 0] = 0;//if rab pop<0 then set the pop value to 0 and quit
                result[i, 1] = 0;
                break;
            }

        }

        return result;
    }
Beispiel #43
0
    public double[,] rabbit_fox_horizontal_same_ts(float r, float f, int yr, float ts, string r_integ_method, string f_integ_method)
    {
        int ts_factor = 10; //time step factor, to define numer of loops in unit of time, e.g. if ts=0.1 then we will have 10 loops in each unit of time
        if (ts >= 0.1)
        {
            ts_factor = 10;
        }
        else if (ts >= 0.009) //>=0.01
        {
            ts_factor = 100;
        }
        else if (ts >= 0.0009) //>=0.001
            ts_factor = 1000;

        //ts_factor = 1000;

        Rabbit rab = new Rabbit();
        Fox fx = new Fox();

        RungeKutta rk = new RungeKutta();

        //the system will loop according to the defined time step
        //int lp = Convert.ToInt16(Math.Truncate(yr / ts)); //total number of loop due to the defined time step
        //int lp = Convert.ToInt32(Math.Truncate(yr / 0.1)); //10 timestep in 1 year
        int lp = yr * ts_factor;

        lp = lp + 2;
        double[,] result = new double[lp, 2];

        float fr = r; //rabbit population for fox model

        for (int i = 1; i < lp; i++)
        {

            //if (i % (Convert.ToInt16(Math.Truncate(ts * 10))) == 0)
            if (i % (Convert.ToInt16(ts * ts_factor)) == 0)
            {
                //run rabbit model
                if (r_integ_method == "Runge-Kutta") // for Runge-Kutta integration of rabbit
                {
                    r = rk.calc_Rabbit_Runge_Kutta(r, f, ts);
                }
                else
                  //for euler integration
                    r = r + rab.rabbit_model(r, f) * ts;
                // r = r + rabbit_with_diff_func(r, f) * ts; //rabbit with px/(q+x) function than bx

                //run fox model
                if (f_integ_method == "Runge-Kutta") // for Runge-Kutta integration of fox model
                {
                    f = rk.calc_Fox_Runge_Kutta(f, fr, ts);
                }
                else
                    f = f + fx.fox_model(f, fr) * ts;
                //f = f + fox_with_diff_func(f, fr) * ts; //fox with px/(q+x) function than bx

                fr = r; //update current rabbit population for fox model

                if (r < 0)
                    result[i, 0] = 0;
                else
                    result[i, 0] = r;   //Convert.ToDouble(r.ToString("#.##"));

                if (f < 0)
                    result[i, 1] = 0;
                else
                    result[i, 1] = f;   // Convert.ToDouble(f.ToString("#.##"));

                if (result[i, 0] < 0) //(result[i, 0] < 1)
                {
                    result[i, 0] = 0; //if pop<0 then set the pop value to 0
                    result[i, 1] = 0;
                    break;
                }
            }
            else
            {
                if (r < 0) //(result[i, 0] < 1)
                {
                    result[i, 0] = 0; //if pop<0 then set the pop value to 0
                    result[i, 1] = 0;
                    break;
                }
                else
                {
                    result[i, 0] = r;
                    result[i, 1] = f;
                }

            }
        }

        return result;
    }
Beispiel #44
0
 public void Visit(Rabbit rabbit)
 {
     Interlocked.Increment(ref this.rabbits);
 }
Beispiel #45
0
 public void createRabbit()
 {
     var field = getAvailableField();
     Rabbit tempRabbit = new Rabbit(this, posX, posY);
     field.animal = tempRabbit;
     animalList.Add(tempRabbit);
 }
	public void Start()
	{
	    _rabbitComponent = GetComponent<Rabbit>();
	}
Beispiel #47
0
 private static Rabbit CreateRabbitWith50Health(Image rabbitImage, Point position)
 {
     var rabbit = new Rabbit(rabbitImage, position);
     rabbit.SetHealth(50);
     return rabbit;
 }
 public void Start()
 {
     _rabbitComponent = GetComponent<Rabbit>();
     _rabbitComponent.SetIdle(IsIdle);
 }
Beispiel #49
0
        private void GetNNStat(string type)
        {
            // По каждой папке изучаемого ...
            foreach (var rabbit in rabbits)
            {
                // Path.GetFileName(rabbit) возвращает название папки кролика
                // ...//Батчаев Роберт -> Батчаев Роберт

                string nn_path = Path.Combine(rabbit, "сети");
                Network[] networks = new Network[0];
                if(type == "way")
                {
                    networks = new Network[4]{
                        Network.Load(Path.Combine(nn_path,"network-1.nn")),
                        Network.Load(Path.Combine(nn_path,"network-2.nn")),
                        Network.Load(Path.Combine(nn_path,"network-3.nn")),
                        Network.Load(Path.Combine(nn_path,"network-4.nn"))
                    };
                } else if(type == "angle")
                {
                    networks = new Network[4]{
                        Network.Load(Path.Combine(nn_path,"network-0.nn")),
                        Network.Load(Path.Combine(nn_path,"network-90.nn")),
                        Network.Load(Path.Combine(nn_path,"network-180.nn")),
                        Network.Load(Path.Combine(nn_path,"network-270.nn"))
                    };
                }

                Rabbit _rabbit = new Rabbit(networks);

                // Пути к файлам статистик ходов исследуемых
                stats = Directory.GetFiles(Path.Combine(rabbit, "ходы"), "*.txt");
                Dictionary<string, NNWalkingStat> walks = new Dictionary<string, NNWalkingStat>();
                Dictionary<string, NNWalkingStat> walks_rage = new Dictionary<string, NNWalkingStat>();

                foreach (var stat in stats)
                {
                    walks.Add(     stat, _rabbit.GetSteps(stat, false));
                    walks_rage.Add(stat, _rabbit.GetSteps(stat, true));
                }

                NNWalkingStat totalWalk = NNWalkingStat.Sum(walks);
                NNWalkingStat totalWalkRage = NNWalkingStat.Sum(walks_rage);

                StringBuilder sb = new StringBuilder();
                string path = string.Empty;

                sb.AppendLine("totalErrors\tbonuses\tup\tright\tdown\tleft\ttotalGoods");
                sb.AppendLine(
                    totalWalk.totalErrors + "\t" +
                    totalWalk.totalBonuses + "\t" +
                    totalWalk.totalWays[0] + "\t" +
                    totalWalk.totalWays[1] + "\t" +
                    totalWalk.totalWays[2] + "\t" +
                    totalWalk.totalWays[3] + "\t" +
                    totalWalk.totalGoods
                );
                path = "\\[automated]ошибки-без-встряхивания.txt";
                System.IO.File.WriteAllText(rabbit + path, sb.ToString());

                sb.Clear();

                sb.AppendLine("totalErrors\tbonuses\tup\tright\tdown\tleft\ttotalGoods");
                sb.AppendLine(
                    totalWalkRage.totalErrors + "\t" +
                    totalWalkRage.totalBonuses + "\t" +
                    totalWalkRage.totalWays[0] + "\t" +
                    totalWalkRage.totalWays[1] + "\t" +
                    totalWalkRage.totalWays[2] + "\t" +
                    totalWalkRage.totalWays[3] + "\t" +
                    totalWalkRage.totalGoods
                );
                path = "\\[automated]ошибки-со-встряхиванием.txt";
                System.IO.File.WriteAllText(rabbit + path, sb.ToString());

            }//foreach (var rabbit in rabbits)
            MessageBox.Show("");
            Application.Exit();
        }
        /// <summary>
        /// Creates the explosion.
        /// </summary>
        /// <param name="rabbit1">The rabbit1.</param>
        /// <param name="rabbit2">The rabbit2.</param>
        private void CreateExplosion(Rabbit rabbit1, Rabbit rabbit2)
        {
            var explosionSystem = this.explosionParticles;
            var explosionTransform = this.explosionTransform;
            if (explosionSystem == null || explosionTransform == null)
            {
                return;
            }

            Vector2 rabbit1Position = new Vector2(rabbit1.Transform2D.X, rabbit1.Transform2D.Y);
            Vector2 rabbit2Position = new Vector2(rabbit2.Transform2D.X, rabbit2.Transform2D.Y);

            Vector2 distance = rabbit2Position - rabbit1Position;
            float length = distance.Length();
            distance.Normalize();


            Vector2 explosionPosition = rabbit1Position + distance * length / 2;
            explosionTransform.X = explosionPosition.X;
            explosionTransform.Y = explosionPosition.Y;

            explosionSystem.Emit = true;
            WaveServices.TimerFactory.CreateTimer("explosionTimer", TimeSpan.FromSeconds(0.1), () =>
            {
                explosionSystem.Emit = false;
            }, false);

            SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Explosion);
        }
        /// <summary>
        /// Creates the explosion.
        /// </summary>
        /// <param name="rabbit1">The rabbit1.</param>
        private void CreateExplosion(Rabbit rabbit1)
        {
            var explosionSystem = this.explosionParticles;
            var explosionTransform = this.explosionTransform;
            if (explosionSystem == null || explosionTransform == null)
            {
                return;
            }

            Vector2 explosionPosition = new Vector2(rabbit1.Transform2D.X, rabbit1.Transform2D.Y);
            explosionTransform.X = explosionPosition.X;
            explosionTransform.Y = explosionPosition.Y;

            explosionSystem.Emit = true;
            WaveServices.TimerFactory.CreateTimer("explosionTimer", TimeSpan.FromSeconds(0.1), () =>
            {
                explosionSystem.Emit = false;
            }, false);

            SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Explosion);
        }
Beispiel #52
0
 public virtual void Visit(Rabbit rabbit)
 {
 }
Beispiel #53
0
		private static Rabbit CreateRabbitWith50Health(Vector2D position)
		{
			var rabbit = new Rabbit(position, new Size(0.1f));
			rabbit.SetHealth(50);
			return rabbit;
		}