예제 #1
0
        //Расчет стрельбы
        public void ActShot(List <ListUnit> ListParty, ListShot listShot)
        {
            //Расчет пуль
            for (int i = 0; i < listShot.listShot.Count; i++)
            {
                shot = listShot.listShot[i];
                shot.MoveShot();

                if (shot.Delta(shot.position, shot.target) < 17 || shot.speed < 5)
                {
                    //Расчет дамажа
                    foreach (ListUnit party in ListParty)
                    {
                        foreach (dynamic unit in party.listUnits)
                        {
                            if (unit.act != Act.DEAD)
                            {
                                delta = unit.Delta(shot.position, unit.position);
                                if (delta < 30)
                                {
                                    unit.life -= 50 / delta;
                                }
                            }
                        }
                    }

                    listShot.RemoveShot(shot);
                }
            }

            //Расчет взрывов
            for (int i = 0; i < listShot.listBang.Count; i++)
            {
                bang = listShot.listBang[i];
                if (bang.time > 96)
                {
                    listShot.RemoveBang(bang);
                }
                else
                {
                    bang.time += 11;
                }
            }

            //Расчет воронок
            for (int i = 0; i < listShot.listCrater.Count; i++)
            {
                crater = listShot.listCrater[i];
                if (crater.time > 300)
                {
                    listShot.RemoveCrater(crater);
                }
                else
                {
                    crater.time++;
                }
            }
        }
예제 #2
0
        //Расчет стрельбы
        public void ActShot(List <ListUnit> ListParty, ListShot listShot)
        {
            //Перерасчет пуль
            for (int i = 0; i < listShot.listShot.Count; i++)
            {
                shot = listShot.listShot[i];
                shot.MoveShot();
                if (shot.Delta(shot.position, shot.target) < 32 || shot.speed < 2)
                {
                    //Расчет дамага
                    foreach (ListUnit party in ListParty)
                    {
                        foreach (dynamic unit in party.listUnits)
                        {
                            if (unit.act != Act.DEAD)
                            {
                                delta = unit.Delta(shot.position, unit.position);
                                if (delta < 48)
                                {
                                    unit.life -= 175 / delta;
                                }
                            }
                        }
                    }
                    listShot.RemoveShot(shot);
                }
            }

            //Перерасчет Взрывов
            for (int i = 0; i < listShot.listBang.Count; i++)
            {
                bang = listShot.listBang[i];
                if (bang.time > 75)
                {
                    listShot.RemoveBang(bang);
                }
                else
                {
                    bang.time += 4;
                }
            }
            //Перерасчет Воронок
            for (int i = 0; i < listShot.listCratar.Count; i++)
            {
                cratar = listShot.listCratar[i];
                if (cratar.time > 600)
                {
                    listShot.RemoveCratar(cratar);
                }
                else
                {
                    cratar.time++;
                }
            }
        }