示例#1
0
        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)
            {
                NPs = new NavigationPointInfo[_player.UniqueNavPoints.Length];
                _player.UniqueNavPoints.CopyTo(NPs, 0);
                this.NPoint = _player.GetNextCyclicNavPoint(this.NPs, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
            }

            if (NPNumber >= 0)
            {
                //���� �� ����� �� ���� � ������ �����, �� �������� � ��� ����������� � ����������� �����.
                if ((this.Location == this.NPoint)
                        && (_player.CurrentTurn > this.NPs[NPNumber].StartTurn))
                {
                    if (!paused)
                    {
                        paused = true;
                        return;
                    }
                    paused = false;
                    this.NPs[NPNumber].Complete = true;
                    this.NPoint = _player.GetNextCyclicNavPoint(this.NPs, 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;
                    }
                }

                //���� �� �� 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;
                }
            }
        }
示例#2
0
        public void Action(MyAI _player)
        {
            //NPNumber == -10 ��������, ��� ��� NavigationObjectives ��� ���������
            if (this.NPNumber == -10)
            {
                this.ForceAutoDestruction();
                return;
            }

            //NPNumber == -1 ��������, ��� ��������� ������ ��������, � ��� ���� ��������� ����
            if (this.NPNumber == -1)
            {
                NPs = new NavigationPointInfo[_player.UniqueNavPoints.Length];
                _player.UniqueNavPoints.CopyTo(NPs, 0);
                this.NPoint = _player.GetNextCyclicNavPoint(this.NPs, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
            }

            //���� �� ����� �� ���� � ������ �����, �� �������� � ��� ����������� � ����������� �����.
            if ((this.Location == this.NPoint)
                    && (_player.CurrentTurn > this.NPs[NPNumber].StartTurn)
                    /*&& (_player.CurrentTurn < this.NPs[NPNumber].EndTurn)*/)
            {
                if (!paused)
                {
                    paused = true;
                    return;
                }
                paused = false;
                this.NPs[NPNumber].Complete = true;
                this.NPoint = _player.GetNextCyclicNavPoint(this.NPs, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
            }

            //���� �� �����, ������ �� �� ����� ������� ����, �� ��� � ��� �����.
            if (this.State == NanoBotState.WaitingOrders)
            {
                if (this.Location != this.NPoint)
                {
                    MoveTo(_player.ePathfinder.FindPath(this.Location, NPoint));
                    return;
                }
            }
        }