public ConsiderRaderScan(Rectanglef mapSize) { this.mapSize = mapSize; curPriority = ConsiderPriority.Vacancy; firstCircleFinished = false; lastState = State.Start; }
public void Update(float seconds) { Area curArea = FindCurArea(); if (curArea != lastArea && curArea != Area.Middle) { Authorize(); return; } if (turning) { orderServer.TurnRightSpeed = turnRightSpeed; orderServer.ForwardSpeed = forwardSpeed; rotaAng -= orderServer.MaxRotaSpeed * seconds; if (rotaAng <= 0) { turning = false; orderServer.TurnRightSpeed = 0; orderServer.ForwardSpeed = orderServer.MaxForwardSpeed; } } if (curArea == Area.Middle) { curPriority = ConsiderPriority.Vacancy; orderServer.ForwardSpeed = 0; orderServer.TurnRightSpeed = 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; }
public ConsiderAwayFromBorder(Rectanglef mapSize, float guardDestance, float spaceForTankWidth) { this.mapSize = mapSize; this.guardDestance = guardDestance; this.spaceForTankWidth = spaceForTankWidth; curPriority = ConsiderPriority.Vacancy; }
public void Observe() { Vector2 curPos = orderServer.Pos; if (curPos.X < mapSize.X + guardDestance || curPos.X > mapSize.X + mapSize.Width - guardDestance || curPos.Y < mapSize.Y + guardDestance || curPos.Y > mapSize.Y + mapSize.Height - guardDestance) { curPriority = ConsiderPriority.Urgency; } }
public void Observe() { List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count == 0) { curPriority = ConsiderPriority.Low; } else { curPriority = ConsiderPriority.Vacancy; } }
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; } }
public void Observe() { List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count == 0) { curPriority = ConsiderPriority.Low; } Point curGrid = FindCurGrid(); if (curGrid != LastGrid) { LastGrid = curGrid; UpdateCurGridTime(curGrid); enterNewGrid = true; } }
public void Update(float seconds) { curTime += seconds; if (enterNewGrid) { Authorize(); enterNewGrid = false; } List <IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count != 0) { curPriority = ConsiderPriority.Vacancy; action.StopMove(); action.StopRota(); } action.Update(seconds); }
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; }
public ConsiderSearchEnemy(Rectanglef mapSize, float raderRadius) { this.mapSize = mapSize; curPriority = ConsiderPriority.Vacancy; int gridMaxX = (int)(mapSize.Width / raderRadius) + 1; int gridMaxY = (int)(mapSize.Height / raderRadius) + 1; grids = new float[gridMaxX, gridMaxY]; for (int i = 0; i < gridMaxX; i++) { for (int j = 0; j < gridMaxY; j++) { grids[i, j] = initialGridTime; } } gridWidth = mapSize.Width / gridMaxX; gridHeight = mapSize.Height / gridMaxY; curTime = 0; }
public ConsiderSearchEnemy ( Rectanglef mapSize, float raderRadius ) { this.mapSize = mapSize; curPriority = ConsiderPriority.Vacancy; int gridMaxX = (int)(mapSize.Width / raderRadius) + 1; int gridMaxY = (int)(mapSize.Height / raderRadius) + 1; grids = new float[gridMaxX, gridMaxY]; for (int i = 0; i < gridMaxX; i++) { for (int j = 0; j < gridMaxY; j++) { grids[i, j] = initialGridTime; } } gridWidth = mapSize.Width / gridMaxX; gridHeight = mapSize.Height / gridMaxY; curTime = 0; }
public void Update ( float seconds ) { curTime += seconds; if (enterNewGrid) { Authorize(); enterNewGrid = false; } List<IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count != 0) { curPriority = ConsiderPriority.Vacancy; action.StopMove(); action.StopRota(); } action.Update( seconds ); }
public ConsiderAwayFromBorder(Rectanglef mapSize) { this.mapSize = mapSize; curPriority = ConsiderPriority.Vacancy; }
public ConsiderAwayFromEnemyTurret ( Rectanglef mapSize ) { curPriority = ConsiderPriority.Vacancy; this.mapSize = mapSize; }
public ConsiderKeepDistanceFromEnemy() { curPriority = ConsiderPriority.Vacancy; }
public ConsiderAwayFromEnemyTurret(Rectanglef mapSize) { curPriority = ConsiderPriority.Vacancy; this.mapSize = mapSize; }
public void Observe () { List<IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count == 0) { curPriority = ConsiderPriority.Low; } else { curPriority = ConsiderPriority.Vacancy; } }
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; }
public ConsiderKeepDistanceFromEnemy () { curPriority = ConsiderPriority.Vacancy; }
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; }
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; }
public void Observe () { List<IEyeableInfo> eyeableInfo = orderServer.GetEyeableInfo(); if (eyeableInfo.Count == 0) { curPriority = ConsiderPriority.Low; } Point curGrid = FindCurGrid(); if (curGrid != LastGrid) { LastGrid = curGrid; UpdateCurGridTime( curGrid ); enterNewGrid = true; } }
public ConsiderRaderScan ( Rectanglef mapSize ) { this.mapSize = mapSize; curPriority = ConsiderPriority.Vacancy; firstCircleFinished = false; lastState = State.Start; }