Exemplo n.º 1
0
        public void Action(MyAI _player)
        {
            //NPNumber == -10 ��������, ��� ��� NavigationObjectives ��� ���������
            if (this.NPNumber == -10)
            {
                this.ForceAutoDestruction();
                return;
            }

            //NPNumber == -1 ��������, ��� ��������� ������ ��������, � ��� ���� ��������� ����
            if (this.NPNumber == -1)
            {
                //this.NPoint = _player.GetNearestUndoneNavPoint(this.Location, ref this.NPNumber);
                this.NPoint = _player.GetNextUndoneNavPoint(this.Location, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
            }

            //���� ����� ������������, ��� ����, � ������� ���, ��� ���-�� ��������, �� ����������� ����� � ���������������.
            if (_player.NavigationPoints[NPNumber].Complete == true)
            {
                //this.NPoint = _player.GetNearestUndoneNavPoint(this.Location, ref this.NPNumber);
                this.NPoint = _player.GetNextUndoneNavPoint(this.Location, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
                this.StopMoving();
            }

            //���� �� ����� �� ���� � ������ �����, �� �������� � ��� ����������� � ����������� �����.
            if ((this.Location == this.NPoint)
                    && (_player.CurrentTurn > _player.NavigationPoints[NPNumber].StartTurn)
                    && (_player.CurrentTurn < _player.NavigationPoints[NPNumber].EndTurn))
            {
                List<VG.Mission.BaseObjective> mission = _player.Mission.Objectives;
                for (int i = 0; i < mission.Count; i++)
                {
                    if (mission[i].ID == 1)
                    {
                        //Navigation
                        VG.Mission.NavigationObjective navObj = (VG.Mission.NavigationObjective)mission[i];
                        for (int j = 0; j < navObj.NavPoints.Count; j++)
                        {
                            if (this.Location == navObj.NavPoints[j].Location && navObj.NavPoints[j].Reached == true)
                                _player.NavigationPoints[NPNumber].Complete = true;
                        }
                    }
                }
                this.NPoint = _player.GetNextUndoneNavPoint(this.Location, ref this.NPNumber);
                if (this.NPNumber == -10)
                {
                    this.ForceAutoDestruction();
                    return;
                }
            }

            //���� �� �����, ������ �� �� ����� ������� ����, �� ��� � ��� �����.
            if (this.State == NanoBotState.WaitingOrders)
            {
                if (this.Location != this.NPoint)
                {
                    //MoveTo(NPoint);
                    MoveTo(_player.ePathfinder.FindPath(this.Location, NPoint));
                    return;
                }
            }
        }
Exemplo n.º 2
0
        public void Action(MyAI _player)
        {
            if (this.NPNumber == -1)
            {
                this.NPoint = _player.GetNextUndoneNavPoint(this.Location, ref this.NPNumber);
            }

            if (_player.NavigationPoints[NPNumber].Complete == true)
            {
                this.NPoint = _player.GetNextUndoneNavPoint(this.Location, ref this.NPNumber);
                this.StopMoving();
            }

            if ((this.Location == this.NPoint)
                    && (_player.CurrentTurn > _player.NavigationPoints[NPNumber].StartTurn)
                    && (_player.CurrentTurn < _player.NavigationPoints[NPNumber].EndTurn))
            {
                _player.NavigationPoints[NPNumber].Complete = true;
            }

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