コード例 #1
0
ファイル: Convoy.cs プロジェクト: petrpopov/imaginecupstuff
 public ConvoyWithBigContainer()
 {
     State = ConvoyState.UnderConstruction;
     DefendersNumber = 0;
     ContainersNumber = 0;
     Location = new Point(-1, -1);
     APoint = new Point(-1, -1);
     HPoint = new Point(-1, -1);
     HPNumber = -1;
     Path = null;
     MyContainer = null;
     MyDefender = null;
 }
コード例 #2
0
ファイル: Convoy.cs プロジェクト: petrpopov/imaginecupstuff
 //����������� ������
 public void Delete()
 {
     if (MyDefender != null)
         MyDefender.ForceAutoDestruction();
     if (MyContainer != null)
         MyContainer.ForceAutoDestruction();
     ContainersNumber = 0;
     DefendersNumber = 0;
     State = ConvoyState.UnderConstruction;
     MyDefender = null;
     MyContainer = null;
     HPNumber = -1;
 }
コード例 #3
0
ファイル: Convoy.cs プロジェクト: petrpopov/imaginecupstuff
        //���������� ������� ��������� ������
        private void SetState(MyAI _player)
        {
            if (State == ConvoyState.Deleted)
                return;

            //��������, ���� �� ����
            if (MyDefender != null && MyDefender.HitPoint <= 0)
                MyDefender = null;
            if (MyContainer != null && MyContainer.HitPoint <= 0)
                MyContainer = null;

            //���� ����� ���, �� ������ ���������
            if (MyDefender == null && MyContainer == null)
            {
                this.State = ConvoyState.UnderConstruction;
                this.MyDefender = null;
                this.MyContainer = null;
                this.DefendersNumber = 0;
                this.ContainersNumber = 0;
                this.HPNumber = -1;
                return;
            }

            //��������� ������ ��� Stock � Location
            this.Stock = 0;
            if (MyDefender != null)
            {
                this.Location = MyDefender.Location;
            }
            if (MyContainer != null)
            {
                this.Location = MyContainer.Location;
                this.Stock += MyContainer.Stock;
            }

            //���� HP �� ��������, �� ����������
            if (this.HPNumber == -1)
            {
                //this.HPoint = _player.GetNearestHPForConvoy(this.Location, ref HPNumber);

                this.HPoint = _player.GetNextHPForConvoyWithBigContainer(this.Location, ref this.HPNumber);
                if (HPNumber == -10)
                {
                    this.Delete();
                    this.State = ConvoyState.Deleted;
                    return;
                }
            }

            if (this.HPNumber >= 0)
            {
                if (_player.NavigationPoints[HPNumber].Complete == true)
                {
                    this.HPoint = _player.GetNextHPForConvoyWithBigContainer(this.Location, ref this.HPNumber);
                    if (HPNumber == -10)
                    {
                        this.Delete();
                        this.State = ConvoyState.Deleted;
                        return;
                    }
                    this.Stop();
                }
            }

            //���� Defender � ���, �� ������ � ������ � ���
            if (MyDefender != null && MyDefender.State == NanoBotState.Defending)
            {
                this.State = ConvoyState.Fighting;
                return;
            }

            //������-������ ���������� ��-�� ����, ��� ������, ��� ���, � ��� deadlink
            if (MyDefender != null)
            {
                if (MyContainer != null)
                {
                    if ((MyDefender.State == NanoBotState.WaitingOrders)
                        && (MyContainer.State == NanoBotState.WaitingOrders))
                    {
                        this.State = ConvoyState.Waiting;
                    }
                    if ((MyDefender.State == NanoBotState.Moving)
                        || (MyContainer.State == NanoBotState.Moving))
                    {
                        this.State = ConvoyState.Moving;
                    }
                    if ((MyContainer.State == NanoBotState.Collecting))
                    {
                        this.State = ConvoyState.CollectingAZN;
                    }
                    if ((MyContainer.State == NanoBotState.TransferingStock))
                    {
                        this.State = ConvoyState.TransferingAZN;
                    }
                }
            }
            else
            {
                if (MyContainer != null)
                {
                    if ((MyContainer.State == NanoBotState.WaitingOrders))
                    {
                        this.State = ConvoyState.Waiting;
                    }
                    if ((MyContainer.State == NanoBotState.Moving))
                    {
                        this.State = ConvoyState.Moving;
                    }
                    if ((MyContainer.State == NanoBotState.Collecting))
                    {
                        this.State = ConvoyState.CollectingAZN;
                    }
                    if ((MyContainer.State == NanoBotState.TransferingStock))
                    {
                        this.State = ConvoyState.TransferingAZN;
                    }
                }
                else if (MyContainer == null)
                {
                    this.State = ConvoyState.UnderConstruction;
                    this.MyDefender = null;
                    this.MyContainer = null;
                    this.ContainersNumber = 0;
                    this.DefendersNumber = 0;
                    this.HPNumber = -1;
                }
            }
        }
コード例 #4
0
ファイル: Convoy.cs プロジェクト: petrpopov/imaginecupstuff
 //"�����������" ������ ���� � ������
 public void AddBot(NanoBot bot)
 {
     if (this.State != ConvoyState.UnderConstruction)
         return;
     if ((bot is ConvoyDefender3) && (MyDefender == null))
     {
         MyDefender = (ConvoyDefender3)bot;
         return;
     }
     if (bot is BigConvoyContainer)
     {
         if (MyContainer == null)
         {
             MyContainer = (BigConvoyContainer)bot;
             return;
         }
     }
 }