//Расчет стрельбы 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++; } } }
//Расчет стрельбы 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++; } } }
//Перебор всех юнитов public void ActUnit(List <ListUnit> ListParty, ListShot listShot) { this.ListParty = ListParty; this.listShot = listShot; foreach (ListUnit party in ListParty) { foreach (dynamic unit in party.listUnits) { if (unit.act != Act.DEAD) { Logic(unit); } } } }
//Старт игры public void StartGame() { ListParty = new List <ListUnit>(); ListParty.Add(new ListUnit(Color.Red, new Point(20, 20))); ListParty.Add(new ListUnit(Color.Blue, new Point(80, 80), 5, 5)); //ListParty.Add(new ListUnit()); //ListParty.Add(new ListUnit(new Point(80, 80), 5, 5)); //ListParty.Add(new ListUnit(Color.Yellow, new Point(20, 80), 5)); //SW(); Sound.Music(); listShot = new ListShot(); action = new Action(); shooting = new Shooting(); }
//Старт игры public void StartGame() { ListParty = new List <ListUnit>(); //Цвет█Позиция█Танки█Машинки█ // #1 ListParty.Add(new ListUnit()); // #2 ListParty.Add(new ListUnit(Color.Red, new Point(30, 20))); // #3 ListParty.Add(new ListUnit(Color.Blue, new Point(70, 20), 2, 1)); // #4 ListParty.Add(new ListUnit(new Point(70, 80), 2, 1)); // #5 ListParty.Add(new ListUnit(Color.Yellow, new Point(30, 80), 1)); listShot = new ListShot(); actions = new Actions(); shooting = new Shooting(); //Sound.Music(); }