Пример #1
0
        private State FindCurState()
        {
            List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo();

            if (eyeableInfo.Count != 0)
            {
                IEyeableInfo first = eyeableInfo[0];
                if (first is TankSinTur.TankCommonEyeableInfo)
                {
                    TankSinTur.TankCommonEyeableInfo enemyInfo = (TankSinTur.TankCommonEyeableInfo)first;
                    enemyPos = enemyInfo.Pos;
                    float Distance = Vector2.Distance(enemyPos, orderServer.Pos);
                    if (Distance > maxGuardFactor * raderRadius)
                    {
                        return(State.Far);
                    }
                    else if (Distance < minGuardFactor * raderRadius)
                    {
                        return(State.Near);
                    }
                    else
                    {
                        return(State.Mid);
                    }
                }
            }
            return(State.Mid);
        }
Пример #2
0
        public void Observe()
        {
            List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo();

            if (eyeableInfo.Count != 0)
            {
                IEyeableInfo first = eyeableInfo[0];
                if (first is TankSinTur.TankCommonEyeableInfo)
                {
                    TankSinTur.TankCommonEyeableInfo enemyInfo = (TankSinTur.TankCommonEyeableInfo)first;
                    enemyPos = enemyInfo.Pos;
                    float Distance = Vector2.Distance(enemyPos, orderServer.Pos);

                    Vector2 curPos   = orderServer.Pos;
                    Vector2 enemyVec = Vector2.Normalize(curPos - enemyPos);
                    Vector2 curDir   = orderServer.Direction;

                    Vector2 lineVec = new Vector2(enemyVec.Y, -enemyVec.X);
                    if (Vector2.Dot(lineVec, curDir) < 0)
                    {
                        lineVec = -lineVec;
                    }
                    if (Distance > maxGuardFactor * raderRadius || Distance < minGuardFactor * raderRadius ||
                        Vector2.Dot(curDir, lineVec) < 0.8)
                    {
                        curPriority = ConsiderPriority.Urgency;
                        return;
                    }
                }
            }

            curPriority = ConsiderPriority.Vacancy;
        }
Пример #3
0
        public void Observe()
        {
            List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo();

            if (eyeableInfo.Count != 0)
            {
                curPriority = ConsiderPriority.High;
                IEyeableInfo first = eyeableInfo[0];
                if (first is TankSinTur.TankCommonEyeableInfo)
                {
                    TankSinTur.TankCommonEyeableInfo enemyInfo = (TankSinTur.TankCommonEyeableInfo)first;
                    enemyPos = enemyInfo.Pos;
                }
            }
            else
            {
                curPriority = ConsiderPriority.Vacancy;
            }
        }
Пример #4
0
        public void Observe()
        {
            List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo();

            if (eyeableInfo.Count != 0)
            {
                IEyeableInfo first = eyeableInfo[0];
                if (first is TankSinTur.TankCommonEyeableInfo)
                {
                    enemyInfo = (TankSinTur.TankCommonEyeableInfo)first;
                    float selfToEnemyAzi = MathTools.AziFromRefPos(orderServer.Pos - enemyInfo.Pos);
                    float enemyTurretAzi = enemyInfo.TurretAimAzi;
                    if (Math.Abs(MathTools.AngTransInPI(enemyTurretAzi - selfToEnemyAzi)) < guardAng)
                    {
                        curPriority = ConsiderPriority.High;
                        return;
                    }
                }
            }

            curPriority = ConsiderPriority.Vacancy;
        }