Esempio n. 1
0
 public void UpdateRedBloodCell(RedBloodCell redBloodCell)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         uow.RedBloodCellRepository.Update(redBloodCell);
         uow.Save();
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string antigen  = "0";
            bool   rh       = false;
            string antibody = "AB";

            if (!bloodTypeIsKnown)
            {
                antigen = antigenPanel.Controls.OfType <RadioButton>()
                          .FirstOrDefault(r => r.Checked).Text;
                rh = this.rhPositive.Checked;
            }
            else
            {
                antigen = donor.bloodType;
                rh      = donor.rh;
            }


            if (antigen == "A")
            {
                antibody = "B";
            }

            if (antigen == "B")
            {
                antibody = "A";
            }

            if (antigen == "AB")
            {
                antibody = "0";
            }

            if (antigen == "0")
            {
                antibody = "AB";
            }


            bloodType += (rh) ? " Pozitiv" : " Negativ";

            int pressure = int.Parse(bloodPressure.Text);
            int pulse    = int.Parse(bloodPulse.Text);

            float redQ    = float.Parse(redQuantity.Text);
            float trombQ  = float.Parse(trombQuantity.Text);
            float plasmaQ = float.Parse(plasmaQuantity.Text);

            plasma       = new Plasma(antibody, this.donationCenterId, donor.cnp, plasmaQ, DateTime.Now, donor.email);
            tromb        = new Trombocyte(this.donationCenterId, donor.cnp, trombQ, DateTime.Now, donor.email);
            red          = new RedBloodCell(antigen, rh, this.donationCenterId, donor.cnp, redQ, DateTime.Now, donor.email);
            donation     = new Donation(donor.cnp, redQ + trombQ + plasmaQ, pulse, pressure, DateTime.Now, plasmaQ, redQ, trombQ);
            DialogResult = DialogResult.OK;
            Close();
        }
Esempio n. 3
0
 public void SeparateBloodBag(BloodBag bloodBag, Thrombocyte t, Plasma p, RedBloodCell r)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         bloodBag.Stage  = BloodBagStage.Separation;
         bloodBag.Status = BloodBagStatus.Destroyed;
         uow.BloodBagRepository.Update(bloodBag);
         uow.ThrombocyteRepository.Add(t);
         uow.PlasmaRepository.Add(p);
         uow.RedBloodCellRepository.Add(r);
         uow.Save();
     }
 }
Esempio n. 4
0
    public override void GenerateItems(BloodVessel bloodVessel)
    {
        float start     = (Random.Range(0, bloodVessel.pipeSegmentCount) + 0.5f);
        float direction = Random.value < 0.5f ? 1f : -1f;

        float angleStep = bloodVessel.CurveAngle / bloodVessel.CurveSegmentCount;

        for (int i = 0; i < bloodVessel.CurveSegmentCount / 2; i++)
        {
            RedBloodCell rbc          = Instantiate <RedBloodCell>(rbcPrefab);
            float        pipeRotation =
                (start + i * direction) *
                360f / bloodVessel.pipeSegmentCount;
            rbc.Position(bloodVessel, i * angleStep, pipeRotation);
        }
    }
Esempio n. 5
0
        public CellPopulation(int popSize, int popMaxSize, List <Tissue> tissueList, short cellType)
        {
            Simulator.interCellEdges = new StringBuilder();
            Simulator.interCellEdges.AppendLine("frame,cell1,p1,cell2,p2");

            populationSize    = popSize;
            maxPopulationSize = popMaxSize;
            cells             = new MGCell[popMaxSize];
            sigma             = new int[popMaxSize];
            double d = Math.Round(Math.Pow(maxPopulationSize, 1f / 3f));

            dim     = new Vector(d, d, d);
            halfDim = dim / 2;

            contacts        = new int[maxPopulationSize];
            contactsIndices = new int[maxPopulationSize];

            tissues = tissueList;
            int start = 0;

            for (int i = 0; i < tissueList.Count; i++)
            {
                tissues[i].indices = new int[tissues[i].maxPopulationSize];

                start += i == 0 ? 0 : tissueList[i - 1].populationSize;
                for (int j = 0; j < tissueList[i].populationSize; j++)
                {
                    int index = start + j;
                    switch (cellType)
                    {
                    case 1: cells[index] = new RedBloodCell(index, tissueList[i].mesh); break;

                    case 2: cells[index] = new EpithelialCell(index, tissueList[i].mesh); break;

                    default: cells[index] = new MGCell(index, tissueList[i].mesh); break;
                    }
                    //cells[index] = new MGCell(index, tissueList[i].mesh);
                    cells[index].tissueName = tissueList[i].name;
                    tissues[i].indices[j]   = index;
                    tissues[i].cells[j]     = cells[index];
                    sigma[index]            = index;

                    contactsIndices[index] = index;
                    contacts[index]        = 0;
                }
            }
        }
Esempio n. 6
0
 public void Update(RedBloodCell redBloodCell)
 {
     _context.RepositoryContext.RedBloodCellRepository.Update(redBloodCell);
 }
Esempio n. 7
0
 public void Insert(RedBloodCell redBloodCell)
 {
     _context.RepositoryContext.RedBloodCellRepository.Insert(redBloodCell);
 }
        internal static void Load()
        {
            BodilyInfectionLevel l = (This.Game.CurrentLevel != This.Game.NextLevel && This.Game.NextLevel != null ? This.Game.NextLevel : This.Game.CurrentLevel) as BodilyInfectionLevel;

            l.EnemiesDefeated = 0;
            l.waveNumber = 4;

            /// load background
            l.Background = new Background("lungs", "lungs.anim");

            /** load animations */
            l.AddAnimation(new Animation("rbc.anim"));
            l.AddAnimation(new Animation("virusPulse.anim"));
            l.AddAnimation(new Animation("infected.anim"));
            l.AddAnimation(new Animation("antibody.anim"));
            l.AddAnimation(new Animation("shield.anim"));
            l.AddAnimation(new Animation("ship.anim"));
            l.AddAnimation(new Animation("cannon.anim"));
            l.AddAnimation(new Animation("xplosion17.anim"));
            l.AddAnimation(new Animation("BlueExplosion2.anim"));
            l.AddAnimation(new Animation("vulnerable.anim"));
            l.AddAnimation(new Animation("RedExplosion2.anim"));

            /** load sprites */

            // Spawn initial RedBloodCells and Viruses
            LevelFunctions.Spawn(delegate()
            {
                Actor rbcActor = new Actor(l.GetAnimation("rbc.anim"));
                rbcActor.Animations.Add(l.GetAnimation("infected.anim"));
                rbcActor.Animations.Add(l.GetAnimation("vulnerable.anim"));
                rbcActor.Animations.Add(l.GetAnimation("RedExplosion2.anim"));
                Sprite rbc = new RedBloodCell("rbc", rbcActor);
                return rbc;
            }, 5);
            LevelFunctions.Spawn(delegate()
            {
                Actor virusActor = new Actor(l.GetAnimation("virusPulse.anim"));
                virusActor.Animations.Add(l.GetAnimation("BlueExplosion2.anim"));
                return new Virus("virus", virusActor);
            }, 0);

            // Load ship
            Actor shipActor = new Actor(l.GetAnimation("ship.anim"));
            shipActor.Animations.Add(l.GetAnimation("xplosion17.anim"));
            Sprite ship = new Ship("ship", shipActor);

            l.PlayerSpawnPoint = new Vector2(1000, 400);
            ship.Pos = l.PlayerSpawnPoint;

            LevelFunctions.MakeHUD();

            /** load music */
            var audioMan = This.Game.AudioManager;

            //ship spawn
            audioMan.AddSoundEffect("ship_spawn");
            //ship explode
            audioMan.AddSoundEffect("ship_explosion");
            //gun
            audioMan.AddSoundEffect("gun1");
            //rbc die
            audioMan.AddSoundEffect("rbc_die");
            //rbc infected
            audioMan.AddSoundEffect("rbc_infect");
            //virus explode
            audioMan.AddSoundEffect("virus_explode");

            //bg
            audioMan.AddBackgroundMusic("heart_bg");
            audioMan.PlayBackgroundMusic("heart_bg");
            audioMan.BackgroundMusicVolume(.150f);
        }
        internal static void Update()
        {
            GameTime gameTime = This.gameTime;
            if (gameTime.TotalGameTime >= SpawnWaitTime + PreviousSpawn)
            {
                int waveNumber = (This.Game.CurrentLevel as BodilyInfectionLevel).waveNumber++;

                LevelFunctions.Spawn(delegate()
                {
                    Actor virusActor = new Actor(This.Game.CurrentLevel.GetAnimation("virusPulse.anim"));
                    virusActor.Animations.Add(This.Game.CurrentLevel.GetAnimation("BlueExplosion2.anim"));
                    return new Virus("virus", virusActor);
                }, (int)(.75*(Math.Sin((double)waveNumber) + waveNumber)));

                PreviousSpawn = gameTime.TotalGameTime;

                if (This.Game.CurrentLevel.mSprites.FindAll(delegate(WorldObject obj) { return obj.Name == "rbc"; }).Count < 8)
                {
                    LevelFunctions.Spawn(delegate()
                    {
                        Actor rbcActor = new Actor(This.Game.CurrentLevel.GetAnimation("rbc.anim"));
                        rbcActor.Animations.Add(This.Game.CurrentLevel.GetAnimation("infected.anim"));
                        rbcActor.Animations.Add(This.Game.CurrentLevel.GetAnimation("vulnerable.anim"));
                        rbcActor.Animations.Add(This.Game.CurrentLevel.GetAnimation("RedExplosion2.anim"));
                        Sprite rbc = new RedBloodCell("rbc", rbcActor);
                        return rbc;
                    }, waveNumber % 2);
                }
            }
        }
    /// <summary>
    /// Update this instance.
    /// </summary>
    void Update()
    {
        float time = Time.timeSinceLevelLoad;

        //virus speed run
        if (time > startTime && time < endTime)
        {
            StopCoroutine(SpawnRedCellsCoroutine());
            StopCoroutine(SpawnVirusCoroutine());
            if (bloodSpawn == true)
            {
                PlayEpicMusic();
                virusSpecialSpawn = true;
                StartCoroutine(SpawnSpecialVirusCoroutine());
                virusSpecialSpeed     += 3;
                virusSpecialSpawnTime -= .1f;
                if (virusSpecialSpawnTime < .1)
                {
                    virusSpecialSpawnTime = .1f;
                }

                bloodSpawn = false;
                virusSpawn = false;
            }
            GameObject[] viruses;
            viruses = GameObject.FindGameObjectsWithTag("Virus");
            foreach (GameObject virus in viruses)
            {
                VirusScript virus1 = virus.GetComponent <VirusScript> ();
                virus1.speed = virusSpecialSpeed;
            }
            // normal game mode with red blood cells and viruses
        }
        else
        {
            StopCoroutine(SpawnSpecialVirusCoroutine());
            virusSpecialSpawn = false;
            if (bloodSpawn == false)
            {
                GameObject.FindGameObjectWithTag("PassiveMusic1").GetComponent <AudioSource>().Play();
                bloodSpawn = true;
                virusSpawn = true;
                startTime += 100;
                endTime   += 100;
                virusSpeed++;
                bloodSpeed++;
                StartCoroutine(SpawnRedCellsCoroutine());
                StartCoroutine(SpawnVirusCoroutine());
            }
            //changes virus and blood cell speed
            GameObject[] viruses;
            viruses = GameObject.FindGameObjectsWithTag("Virus");
            foreach (GameObject virus in viruses)
            {
                VirusScript virus1 = virus.GetComponent <VirusScript> ();
                virus1.speed = virusSpeed;
            }
            GameObject[] bloods;
            bloods = GameObject.FindGameObjectsWithTag("RedBloodCell");
            foreach (GameObject blood in bloods)
            {
                RedBloodCell blood1 = blood.GetComponent <RedBloodCell> ();
                blood1.speed = bloodSpeed;
            }
            virusSpawnTime = 4.5f - Mathf.Log10(Time.time);
            bloodSpawnTime = 4.0f - Mathf.Log10(Time.time);
        }
    }
        internal static void Load()
        {
            Collision.Lists.Add(new KeyValuePair<int,int>(1,2));

            BodilyInfectionLevel l = (This.Game.CurrentLevel != This.Game.NextLevel && This.Game.NextLevel != null ? This.Game.NextLevel : This.Game.CurrentLevel) as BodilyInfectionLevel;

            GameData.Score = 0;
            GameData.NumberOfLives = GameData.DefaultNumberOfLives;

            l.EnemiesDefeated = 0;
            l.waveNumber = 5;

            /// load background
            l.Background = new Background("stomach", "stomach.anim");

            /** load animations */
            l.AddAnimation(new Animation("rbc.anim"));
            l.AddAnimation(new Animation("virusPulse.anim"));
            l.AddAnimation(new Animation("infected.anim"));
            l.AddAnimation(new Animation("antibody.anim"));
            l.AddAnimation(new Animation("shield.anim"));
            l.AddAnimation(new Animation("ship.anim"));
            l.AddAnimation(new Animation("ship2.anim"));
            l.AddAnimation(new Animation("ship3.anim"));
            l.AddAnimation(new Animation("ship4.anim"));
            l.AddAnimation(new Animation("cannon.anim"));
            l.AddAnimation(new Animation("cannon2.anim"));
            l.AddAnimation(new Animation("cannon3.anim"));
            l.AddAnimation(new Animation("cannon4.anim"));
            l.AddAnimation(new Animation("xplosion17.anim"));
            l.AddAnimation(new Animation("BlueExplosion2.anim"));
            l.AddAnimation(new Animation("vulnerable.anim"));
            l.AddAnimation(new Animation("RedExplosion2.anim"));

            /** load sprites */

            // Load ship
            Actor shipActor = new Actor(l.GetAnimation("ship.anim"));
            shipActor.Animations.Add(l.GetAnimation("xplosion17.anim"));
            Ship ship = new Ship("ship", shipActor, PlayerIndex.One);
            l.PlayerSpawnPoint = new Vector2(1000, 1300);
            l.Camera.Pos = l.PlayerSpawnPoint - new Vector2(This.Game.GraphicsDevice.Viewport.Width / 2,
                This.Game.GraphicsDevice.Viewport.Height / 2);
            ship.Pos = l.PlayerSpawnPoint;

            // Load ship
            if (GamePad.GetState(PlayerIndex.Two).IsConnected)
            {
                shipActor = new Actor(l.GetAnimation("ship2.anim"));
                shipActor.Animations.Add(l.GetAnimation("xplosion17.anim"));
                ship = new Ship("ship2", shipActor, PlayerIndex.Two, "compass_cannon");
                l.PlayerSpawnPoint = new Vector2(1000, 1300);
                l.Camera.Pos = l.PlayerSpawnPoint - new Vector2(This.Game.GraphicsDevice.Viewport.Width / 2,
                    This.Game.GraphicsDevice.Viewport.Height / 2);
                ship.Pos = l.PlayerSpawnPoint;
            }

            // Load ship
            if (GamePad.GetState(PlayerIndex.Three).IsConnected)
            {
                shipActor = new Actor(l.GetAnimation("ship3.anim"));
                shipActor.Animations.Add(l.GetAnimation("xplosion17.anim"));
                ship = new Ship("ship3", shipActor, PlayerIndex.Three, "compass_cannon");
                l.PlayerSpawnPoint = new Vector2(1000, 1300);
                l.Camera.Pos = l.PlayerSpawnPoint - new Vector2(This.Game.GraphicsDevice.Viewport.Width / 2,
                    This.Game.GraphicsDevice.Viewport.Height / 2);
                ship.Pos = l.PlayerSpawnPoint;
            }

            // Spawn initial RedBloodCells and Viruses
            LevelFunctions.Spawn(delegate()
            {
                Actor rbcActor = new Actor(l.GetAnimation("rbc.anim"));
                rbcActor.Animations.Add(l.GetAnimation("infected.anim"));
                rbcActor.Animations.Add(l.GetAnimation("vulnerable.anim"));
                rbcActor.Animations.Add(l.GetAnimation("RedExplosion2.anim"));
                Sprite rbc = new RedBloodCell("rbc", rbcActor);
                return rbc;
            }, 5);
            LevelFunctions.Spawn(delegate()
            {
                Actor virusActor = new Actor(l.GetAnimation("virusPulse.anim"));
                virusActor.Animations.Add(l.GetAnimation("BlueExplosion2.anim"));
                return new Virus("virus", virusActor);
            }, 1);

            LevelFunctions.MakeHUD();

            /** load music */
            var audioMan = This.Game.AudioManager;

            //ship spawn
            audioMan.AddSoundEffect("ship_spawn");
            //ship explode
            audioMan.AddSoundEffect("ship_explosion");
            //gun
            audioMan.AddSoundEffect("gun1");
            //rbc die
            audioMan.AddSoundEffect("rbc_die");
            //rbc infected
            audioMan.AddSoundEffect("rbc_infect");
            //virus explode
            audioMan.AddSoundEffect("virus_explode");

            //bg
            audioMan.AddBackgroundMusic("level1_bg");
            audioMan.PlayBackgroundMusic("level1_bg");
        }
Esempio n. 12
0
 public void Update(RedBloodCell redBloodCell)
 {
     DbOperations.ExecuteCommand(_context.CONNECTION_STRING, "dbo.RedBloodCells_Update", redBloodCell.GenerateSqlParametersFromModel().ToArray());
 }