public void Process(MovementCMap contextMap, Minion m) { directions.Clear(); weights.Clear(); float highest = 1; PlayerData enemy = GameManager.manager.GetOpposingPlayer(m.GetTeam()); foreach (BaseBuilding building in enemy.buildings) { highest = MarkMap(m.Position, building.GetPosition(), highest); } foreach (Minion enemyMinion in enemy.minions) { highest = MarkMap(m.Position, enemyMinion.Position, highest); } highest = MarkMap(m.Position, enemy.controller.transform.position, highest); for (int i = 0; i < weights.Count; i++) { float strength = 1.01f - (weights[i] / highest); contextMap.WriteDirection(directions[i], strength); } }
private void ProcessMovement(MovementCMap movementMap, LookPosCMap lookMap, KeypressCMap keyboardMap, float desire, Vector3 currentPos) { moveDirections.Clear(); moveWeights.Clear(); lookDirections.Clear(); float moveHighest = 1; foreach (var res in GameManager.manager.resources) { if (res.capacity <= 0) { continue; } Vector3 resourcePos = res.thisTransform.position; MarkLookMap(resourcePos); moveHighest = MarkMovementMap(currentPos, resourcePos, moveHighest); } for (int i = 0; i < moveWeights.Count; i++) { float strength = 1.01f - (moveWeights[i] / moveHighest); strength *= desire; // write in movementMap.WriteDirection(moveDirections[i], strength); lookMap.WriteLookPos(lookDirections[i], strength); keyboardMap.WriteKey(BotKeys.PRIMARY_ATTACK, true, strength); } }
private void ProcessMovement(MovementCMap movementMap, LookPosCMap lookMap, KeypressCMap keyboardMap, PlayerData enemyPlayer, Vector3 currentPos) { moveDirections.Clear(); moveWeights.Clear(); lookDirections.Clear(); float moveHighest = 1; // move towards enemy minions foreach (var minion in enemyPlayer.minions) { float sqrDist = (minion.Position - currentPos).sqrMagnitude; // LOOK at the minion MarkLookMap(minion.Position); float closeSqrRange = 36; // possibly MOVE away from it if (sqrDist < closeSqrRange) { moveHighest = MarkMovementMap(minion.Position, currentPos, moveHighest, 2); } else { moveHighest = MarkMovementMap(currentPos, minion.Position, moveHighest, 0); } } // move away from towers, but towards other buildings! foreach (var building in enemyPlayer.buildings) { // LOOK at the building MarkLookMap(building.GetPosition()); float sqrDist = (building.GetPosition() - currentPos).sqrMagnitude; float closeRange = Mathf.Max(building.GetAttackRange() + 1, building.blockingRadius); bool tooClose = sqrDist < (closeRange * closeRange); // possibly MOVE away from it if (tooClose) { moveHighest = MarkMovementMap(building.GetPosition(), currentPos, moveHighest, 10); } else { moveHighest = MarkMovementMap(currentPos, building.GetPosition(), moveHighest, 0); } } for (int i = 0; i < moveWeights.Count; i++) { float strength = 1.01f - (moveWeights[i] / moveHighest); strength += extraWeights[i]; movementMap.WriteDirection(moveDirections[i], strength); lookMap.WriteLookPos(lookDirections[i], strength); keyboardMap.WriteKey(BotKeys.PRIMARY_ATTACK, true, strength); } }
public void Process(MovementCMap movementMap, KeypressCMap keyboardMap, LookPosCMap lookMap, PlayerController controller) { PlayerData enemyPlayer = GameManager.manager.GetOpposingPlayer(controller.team); PlayerData myPlayer = GameManager.manager.GetPlayer(controller.team); Vector3 currentPos = controller.transform.position; // wizard move // do the movement ProcessMovement(movementMap, lookMap, keyboardMap, enemyPlayer, currentPos); // Look at the thing we're moving towards // Press keys to do attacks }
public void Process(MovementCMap movementMap, KeypressCMap keyboardMap, LookPosCMap lookMap, PlayerController controller) { PlayerData enemyPlayer = GameManager.manager.GetOpposingPlayer(controller.team); PlayerData myPlayer = GameManager.manager.GetPlayer(controller.team); // wizard build // MOVE near build spot totalEnemyBuildings = enemyPlayer.buildings.Count; totalMyBuildings = myPlayer.buildings.Count; int towerCount = 1; int barracksCount = 1; foreach (var building in enemyPlayer.buildings) { if (building is TowerBasic) { towerCount++; } else if (building is Barracks) { barracksCount++; } } foreach (var building in myPlayer.buildings) { if (building is TowerBasic) { towerCount--; } else if (building is Barracks) { barracksCount--; } } if (towerCount > 0 && myPlayer.resources > 25) { Vector3 buildPos = GetBuildPos(myPlayer, enemyPlayer); lookMap.WriteLookPos(buildPos, 3 + towerCount); keyboardMap.WriteKey(BotKeys.BUILD_MODE, true, 1); keyboardMap.WriteKey(BotKeys.PRIMARY_ATTACK, true, 1); myPlayer.brain.SetDesiredBuilding(BuildingType.TOWER); } else if (barracksCount > 0 && myPlayer.resources > 50) { Vector3 buildPos = GetBuildPos(myPlayer, enemyPlayer); lookMap.WriteLookPos(buildPos, 3 + barracksCount); keyboardMap.WriteKey(BotKeys.BUILD_MODE, true, 1); keyboardMap.WriteKey(BotKeys.PRIMARY_ATTACK, true, 1); myPlayer.brain.SetDesiredBuilding(BuildingType.BARRACKS); } else { keyboardMap.WriteKey(BotKeys.BUILD_MODE, false, 1); } // Press keys to create buildings }