public void Action(MyAI _player) { Fire = false; //��������� ������ �����������. ���� ���-�� ���������� ������, ���������������. if (_player.OtherNanoBotsInfo != null) { foreach (NanoBotInfo botEnemy in _player.OtherNanoBotsInfo) { if (botEnemy.PlayerID == 0) { Distance = _player.GeomDist(botEnemy.Location, this.Location); if (Distance < this.DefenseDistance) { this.StopMoving(); Fire = true; } } } } //NPNumber == -1 ��������, ��� ��������� ������ ��������, � ��� ���� ��������� ���� if (this.NPNumber == -1) { this.NPoint = _player.GetNextUndoneHealPoint(this.Location, ref this.NPNumber); if (this.NPNumber == -10) { this.ForceAutoDestruction(); return; } } if (NPNumber >= 0) { //���� ����� ������������, ��� ����, � ������� ���, ��� ���-�� ��������, �� ����������� ����� � ���������������. if (_player.NavigationPoints[NPNumber].Complete == true) { this.NPoint = _player.GetNextUndoneHealPoint(this.Location, ref this.NPNumber); if (this.NPNumber == -10) { this.ForceAutoDestruction(); return; } this.StopMoving(); } } if (NPNumber >= 0) { //���� �� ����� �� ���� � ������ �����, �� �������� � ��� ����������� � ����������� �����. if ((this.Location == this.NPoint) && (_player.CurrentTurn > _player.NavigationPoints[NPNumber].StartTurn) && (_player.CurrentTurn < _player.NavigationPoints[NPNumber].EndTurn) && (this.Stock >= _player.NavigationPoints[NPNumber].Stock)) { _player.NavigationPoints[NPNumber].Complete = true; this.NPoint = _player.GetNextUndoneHealPoint(this.Location, ref this.NPNumber); if (this.NPNumber == -10) { this.ForceAutoDestruction(); return; } } } if (this.State == NanoBotState.WaitingOrders) { if (Fire) { //���� ��������� ���� MinDistance = 1000; if (_player.OtherNanoBotsInfo != null) { foreach (NanoBotInfo botEnemy in _player.OtherNanoBotsInfo) { if (botEnemy.PlayerID == 0) { this.Distance = _player.GeomDist(botEnemy.Location, this.Location); //���� ��������� AI ���������� ������, �� �� ���������� ���������� �����������! if ((botEnemy.NanoBotType == NanoBotType.NanoAI) && (Distance < this.DefenseDistance)) { MinDistance = -1; ShootAt = botEnemy.Location; } if (Distance < MinDistance) { MinDistance = Distance; ShootAt = botEnemy.Location; } } } } //���� ��������� ������, �� �������� � ����. if (MinDistance < this.DefenseDistance) { this.DefendTo(ShootAt, 3); return; } } //���� ��� NP ��������, �� ����� if (this.NPNumber == -10) { this.ForceAutoDestruction(); return; } //���� �� �� AZNPoint � ����� ����������, �� �������������� if (this.Location == this.APoint) { if (this.Stock == 0) { CollectFrom(Location, this.ContainerCapacity / this.CollectTransfertSpeed); return; } } //���� ������, �� ������� AZN � ��� �� ��� if (Stock == 0) { this.APoint = _player.GetNearestAZNPoint(this.Location, this.NPoint); MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint)); return; } else { MoveTo(_player.Pathfinder.FindPath(this.Location, this.NPoint)); return; } } }