internal static void MoveAllEntities() { foreach (Unit _unit in m_unitList) { AllianceType allianceType = _unit.m_allianceType; switch (_unit.m_unitType) { case UnitType.KNIGHT: Unit opposingQueen = allianceType == AllianceType.FRIENDLY ? m_player2Queen : m_player1Queen; MoveEntity(_unit, opposingQueen.m_position); break; case UnitType.ARCHER: List <Unit> unitRangeList = m_unitList.OrderBy(x => Vector2.GetDistance(_unit.m_position, x.m_position).GetLength() - Math.Pow(_unit.m_radius, 2) - Math.Pow(x.m_radius, 2)).ToList(); MoveEntity(_unit, unitRangeList[0].m_position); break; case UnitType.GIANT: List <BuildingLocation> enemyTowerRangeList = m_locationList.Where(x => x.m_buildingType == BuildingType.TOWER && x.m_allianceType != allianceType).OrderBy(x => Vector2.GetDistance(_unit.m_position, x.m_position).GetLength() - Math.Pow(_unit.m_radius, 2) - Math.Pow(x.m_radius, 2)).ToList(); MoveEntity(_unit, enemyTowerRangeList[0].m_position); break; } } }
public ZoneModel(MapModel.Party party, AllianceType alliance, WorldPosition wp) { zonePieceModels = new List <ZzFragModel> (); _alliance = alliance; position = wp; _party = party; }
internal void Reset() { m_level = 0; m_remainingBuildTime = -1; m_attackRadius = 0; m_allianceType = AllianceType.NEUTRAL; }
void Start() { currentAlliance = AllianceType.Team1; mapView = Instantiate(mapPrefab, Vector3.zero, Quaternion.identity); mapView.GetComponent <MapView> ()._mapModel = StaticMapCreateData.currentMap; currentUnit = BridgeData.unitRepo._unitsById.ElementAt(0).Value; }
public UnitModel(UnitData unitData, AllianceType alliance) //constructor for the unit, takes unit data, sets it equal in the model. { Id = IdTracker++; Alliance = alliance; UnitData = unitData; hP = new CompositeProperty(unitData.initialHP); //hp starts at 0; this is done throught he added value maxHp = new CompositeProperty(unitData.initialHP); armor = new CompositeProperty(unitData.initialArmor); heal = new CompositeProperty(0); damage = new CompositeProperty(0); moveRange = new CompositeProperty(unitData.initialMoveRange); size = new CompositeProperty(unitData.initialSize); moveSpeed = new CompositeProperty(unitData.initialMoveSpeed); weight = new CompositeProperty(unitData.initialWeight); range = new CompositeProperty(unitData.initialRange); shield = new CompositeProperty(0); shieldReducing = new CompositeProperty(5); //figure out what this is healModifier = new CompositeProperty(0); damageModifier = new CompositeProperty(0); unitType = unitData.unitType; reviveTime = 30; //maybe change this elsewhere dieTime = 30; //hP.setBaseValue (unitData.initialHP); // armor.setBaseValue (unitData.initialArmor); }
public void Load(LogicJSONObject jsonObject) { this.m_allianceName = jsonObject.GetJSONString("alliance_name").GetStringValue(); this.m_allianceBadgeId = jsonObject.GetJSONNumber("badge_id").GetIntValue(); this.m_allianceType = (AllianceType)jsonObject.GetJSONNumber("type").GetIntValue(); this.m_memberCount = jsonObject.GetJSONNumber("member_count").GetIntValue(); this.m_score = jsonObject.GetJSONNumber("score").GetIntValue(); this.m_duelScore = jsonObject.GetJSONNumber("duel_score").GetIntValue(); this.m_requiredScore = jsonObject.GetJSONNumber("required_score").GetIntValue(); this.m_requiredDuelScore = jsonObject.GetJSONNumber("required_duel_score").GetIntValue(); this.m_winWarCount = jsonObject.GetJSONNumber("win_war_count").GetIntValue(); this.m_lostWarCount = jsonObject.GetJSONNumber("lost_war_count").GetIntValue(); this.m_drawWarCount = jsonObject.GetJSONNumber("draw_war_count").GetIntValue(); this.m_warFrequency = jsonObject.GetJSONNumber("war_freq").GetIntValue(); this.m_expLevel = jsonObject.GetJSONNumber("xp_level").GetIntValue(); this.m_expPoints = jsonObject.GetJSONNumber("xp_points").GetIntValue(); this.m_consecutiveWinWarCount = jsonObject.GetJSONNumber("cons_win_war_count").GetIntValue(); this.m_publicWarLog = jsonObject.GetJSONBoolean("public_war_log").IsTrue(); this.m_amicalWarEnabled = jsonObject.GetJSONBoolean("amical_war_enabled").IsTrue(); LogicJSONNumber localeObject = jsonObject.GetJSONNumber("locale"); if (localeObject != null) { this.m_localeData = LogicDataTables.GetDataById(localeObject.GetIntValue()); } LogicJSONNumber originObject = jsonObject.GetJSONNumber("origin"); if (originObject != null) { this.m_originData = LogicDataTables.GetDataById(originObject.GetIntValue()); } }
//REMEMBER ALL ARRAY ELEMENTS ARE ONE LOWER THAN THEY ARE private void CreateArmy(AllianceType alliance, WorldPosition point, float heading) { var direction = MathExtensions.FromHeading(heading + 90f); // first line gets the unit registry data var unitData = _unitRepository.GetById("Spartan"); point += MathExtensions.FromHeading(heading) * (Fix64)3f; SpawnAPoint(alliance, point, unitData, direction, 1); // second line // unitData = _unitRegistry[1]; //point += MathExtensions.FromHeading(heading)* (Fix64)15f; //SpawnAPoint(alliance, point, unitData, direction, 1); //Does not work because I couldn't figure out how to configure the unit view //unitData = _unitRegistry[2]; //point += MathExtensions.FromHeading(heading)* (Fix64)10f; //SpawnAPoint(alliance, point, unitData, direction, 1); //unitData = _unitRegistry[3]; //point += MathExtensions.FromHeading(heading)*3f; //SpawnAPoint(alliance, point, unitData, direction, 1); }
private AllianceType DefaultGetAllianceType(Powers p1, Powers p2) { AllianceEdge p1p2, p2p1; if (!TryGetEdge(p1, p2, out p1p2)) { throw new Exception($"Malformed AllianceScenario p1 -> p2: {p1} -> {p2}"); } if (!TryGetEdge(p2, p1, out p2p1)) { throw new Exception($"Malformed AllianceScenario p2 -> p1: {p2} -> {p1}"); } AllianceType p1p2AllianceType = p1p2.Animosity >= .6d ? AllianceType.Enemy : AllianceType.Friend; AllianceType p2p1AllianceType = p2p1.Animosity >= .6d ? AllianceType.Enemy : AllianceType.Friend; if (p1p2AllianceType == p2p1AllianceType) { return(p1p2AllianceType); } if (p1p2AllianceType == AllianceType.Friend && p2p1AllianceType == AllianceType.Enemy) { return(AllianceType.StabbyTo); } else { return(AllianceType.StabbyFrom); } }
public static bool IsFriendly(this AllianceType self, AllianceType other) { if (self == AllianceType.Player || self == AllianceType.Ally) { return(other == AllianceType.Player || other == AllianceType.Ally); } return(other == AllianceType.Foe); }
public Alliance(DateTime formationDate, AllianceType type, string name, Airport headquarter) { this.FormationDate = formationDate; this.Type = type; this.Name = name; this.Members = new ObservableCollection <AllianceMember>(); this.PendingMembers = new ObservableCollection <PendingAllianceMember>(); this.Headquarter = headquarter; }
public Alliance(DateTime formationDate, AllianceType type, string name, Airport headquarter) { this.FormationDate = formationDate; this.Type = type; this.Name = name; this.Members = new ObservableCollection<AllianceMember>(); this.PendingMembers = new ObservableCollection<PendingAllianceMember>(); this.Headquarter = headquarter; }
private void CreateDude(AllianceType alliance, float heading) { var direction = MathExtensions.FromHeading(heading + 90f); // first line gets the unit registry data var unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(-20, 10), unitData, direction, 1); }
public void SetAllianceSettings(string description, AllianceType type, int badgeId, int requiredScore, int requiredDuelScore, int warFrequency, LogicData originData, bool publicWarLog, bool arrangedWarEnabled) { int allianceLevel = this.Header.GetAllianceLevel(); if (description == null) { description = string.Empty; } if (description.Length > 128) { description = description.Substring(0, 128); } type = (AllianceType)LogicMath.Clamp((int)type, (int)AllianceType.OPEN, (int)AllianceType.CLOSED); AllianceBadgeUtil.ParseAllianceBadgeLayer(badgeId, out LogicAllianceBadgeLayerData middle, out LogicAllianceBadgeLayerData background, out LogicAllianceBadgeLayerData foreground); if (middle != null && middle.GetRequiredClanLevel() > allianceLevel) { middle = AllianceBadgeUtil.GetFirstUnlockedAllianceBadgeLayerByType(LogicAllianceBadgeLayerType.MIDDLE, allianceLevel); } if (background != null && background.GetRequiredClanLevel() > allianceLevel) { background = AllianceBadgeUtil.GetFirstUnlockedAllianceBadgeLayerByType(LogicAllianceBadgeLayerType.BACKGROUND, allianceLevel); } if (foreground != null && foreground.GetRequiredClanLevel() > allianceLevel) { foreground = AllianceBadgeUtil.GetFirstUnlockedAllianceBadgeLayerByType(LogicAllianceBadgeLayerType.FOREGROUND, allianceLevel); } badgeId = AllianceBadgeUtil.GetAllianceBadgeId(middle, background, foreground); if (originData != null && originData.GetDataType() != LogicDataType.REGION) { originData = null; } this.Description = description; this.Header.SetAllianceType(type); this.Header.SetAllianceBadgeId(badgeId); this.Header.SetRequiredScore(requiredScore); this.Header.SetRequiredDuelScore(requiredDuelScore); this.Header.SetWarFrequency(warFrequency); this.Header.SetOriginData(originData); this.Header.SetPublicWarLog(publicWarLog); this.Header.SetArrangedWarEnabled(arrangedWarEnabled); if (this.Members.Count != 0) { LogicAllianceSettingsChangedCommand allianceSettingsChangedCommand = new LogicAllianceSettingsChangedCommand(); allianceSettingsChangedCommand.SetAllianceData(this.Id, badgeId); this.AllowServerCommand(allianceSettingsChangedCommand); this.SendPiranhaMessage(this.GetAllianceFulEntryUpdateMessage(), 1); } }
private void SpawnAPoint(AllianceType alliance, WorldPosition point, UnitData unitData, WorldPosition direction, int count) { for (var i = 0; i < count; i++) { SpawnAPoint(alliance, point, unitData); point += direction * (Fix64)2f; } }
public SpawnUnitCommand(UnitData unitData, AllianceType alliance, WorldPosition unitPosition, UnitManager unitManager, CommandProcessor commandProcessor) { _unitData = unitData; _alliance = alliance; _unitPosition = unitPosition; _unitManager = unitManager; _commandProcessor = commandProcessor; }
private void SpawnAPoint(AllianceType alliance, WorldPosition point, UnitData unitData, WorldPosition direction, int count) { for (var i = 0; i < count; i++) { var command = _spawnUnitCommandFactory.Create(unitData, alliance, point); _commandProcessor.AddCommand(command); point += direction * 2f; } }
public void ChangeAlliance() { if (currentAlliance == AllianceType.Team1) { currentAlliance = AllianceType.Team2; } else { currentAlliance = AllianceType.Team1; } Debug.Log(currentAlliance); }
public UnitModel(UnitData unitData, AllianceType alliance) //constructor for the unit, takes unit data, sets it equal in the model. { Alliance = alliance; UnitData = unitData; hP = new CompositeProperty(unitData.initialHP); armor = new CompositeProperty(unitData.initialArmor); size = new CompositeProperty(unitData.initialSize); moveSpeed = new CompositeProperty(unitData.initialMoveSpeed); weight = new CompositeProperty(unitData.initialWeight); range = new CompositeProperty(unitData.initialRange); unitType = unitData.unitType; //hP.setBaseValue (unitData.initialHP); // armor.setBaseValue (unitData.initialArmor); }
public UnitModel SpawnUnit(UnitData unitData, AllianceType alliance, WorldPosition position //IFactory<UnitModel, Ability2> ability2Factory, //IFactory<UnitModel, Ability3> ability3Factory, //IFactory<UnitModel, Ability4> ability4Factory, //IFactory<UnitModel, Ability5> ability5Factory ) { var unit = _unitFactory.Create(unitData, alliance); unit.SetPosition(position); foreach (var unitAbility in unitData.abilityIDs) { var ability = _abilityRepository.CreateAbilityFromId(unitAbility.AbilityId, unit, unitAbility.AbilityOverride ? unitAbility.AbilityOverrideData : null); unit.Abilities.Add(ability); _commandProcessor.AddCommand(ability); } /* I tried and couldn't get this to work * ITargetAbility abil1 = ability2Factory.Create (unit); //this is not at all how it will really work * _commandProcessor.AddCommand (abil1); * unit.abilities [1] = abil1; * * ITargetAbility abil2 = ability5Factory.Create (unit); * _commandProcessor.AddCommand (abil2); * unit.abilities [2] = abil2; * * ITargetAbility abil3 = ability4Factory.Create (unit); * _commandProcessor.AddCommand (abil3); * unit.abilities [3] = abil3; * * ITargetAbility abil4 = ability3Factory.Create (unit); * _commandProcessor.AddCommand (abil4); * unit.abilities [4] = abil4; * */ _worldModel.Units.Add(unit); //load up abilities; add them to unit: stored inside configuration of unit as array of string IDs. //helper class: takes ability registry: unit manager and spawn unit command: create ability by ID: pass the string, //and it returns the real IAbility state. That class will take the configuration ability data, define //what kind of class we will create for this particular ability. return(unit); }
public Unit(int _x, int _y, AllianceType _allianceType, UnitType _unitType, int _health = -1) { m_position = new Vector2(_x, _y); m_allianceType = _allianceType; m_unitType = _unitType; switch (_unitType) { case UnitType.QUEEN: m_radius = 30; m_movementSpeed = 60; m_health = new Random().Next(25, 100); m_weight = 100; break; case UnitType.KNIGHT: m_radius = 20; m_movementSpeed = 100; m_health = 25; m_weight = 4; break; case UnitType.ARCHER: m_radius = 25; m_movementSpeed = 75; m_health = 45; m_weight = 9; break; case UnitType.GIANT: m_radius = 40; m_movementSpeed = 50; m_health = 200; m_weight = 20; break; } if (_health != -1) { m_health = _health; } }
internal static void Build(AllianceType _allianceType, int siteId, BuildingType _type) { BuildingLocation location = m_locationList[siteId]; if (_allianceType != location.m_allianceType && location.m_buildingType == BuildingType.TOWER) { return; } if (_allianceType == location.m_allianceType && _type == location.m_buildingType) { if (location.m_buildingType == BuildingType.MINE) { ++location.m_level; if (location.m_level > location.m_maxYield) { location.m_level = location.m_maxYield; } } else if (location.m_buildingType == BuildingType.TOWER) { location.m_level += 100; if (location.m_level > 800) { location.m_level = 800; } } } else { location.Reset(); location.m_allianceType = _allianceType; location.m_buildingType = _type; if (location.m_buildingType == BuildingType.TOWER) { location.m_level = 100; } } }
public bool allTeamUnitsDead(AllianceType alliance) { int numberofTeamUnits = 0; foreach (UnitModel unit in _worldModel.GetAllUnits().Where((UnitModel unit) => unit.Alliance == alliance)) { numberofTeamUnits++; if (unit.AliveState.Value == UnitModel.AliveStateFlag.Alive) { return(false); } } if (numberofTeamUnits > 0) { return(true); } else { Debug.Log(numberofTeamUnits + alliance.ToString()); return(false); } }
public UnitModel SpawnUnit(UnitData unitData, AllianceType alliance, WorldPosition position) { var unit = _unitFactory.Create(unitData, alliance); unit.SetPosition(position); foreach (var unitAbility in unitData.abilityIDs) { var ability = _abilityRepository.CreateAbilityFromId(unitAbility.AbilityId, unit, unitAbility.AbilityOverride ? unitAbility.AbilityOverrideData : null); unit.Abilities.Add(ability); _commandProcessor.AddCommand(ability); } _worldModel.Units.Add(unit); //load up abilities; add them to unit: stored inside configuration of unit as array of string IDs. //helper class: takes ability registry: unit manager and spawn unit command: create ability by ID: pass the string, //and it returns the real IAbility state. That class will take the configuration ability data, define //what kind of class we will create for this particular ability. return(unit); }
public void ChangeAlliance() { switch (currentAlliance) { case AllianceType.Team1: currentAlliance = AllianceType.Team2; break; case AllianceType.Team2: currentAlliance = AllianceType.Team3; break; case AllianceType.Team3: currentAlliance = AllianceType.Team4; break; case AllianceType.Team4: currentAlliance = AllianceType.Team5; break; case AllianceType.Team5: currentAlliance = AllianceType.Team6; break; case AllianceType.Team6: currentAlliance = AllianceType.Team7; break; case AllianceType.Team7: currentAlliance = AllianceType.Team8; break; case AllianceType.Team8: currentAlliance = AllianceType.Team1; break; } Debug.Log(currentAlliance); }
private void CreateArmy2(AllianceType alliance, float heading) { var direction = MathExtensions.FromHeading(heading + 90f); // first line gets the unit registry data var unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(20, 10), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(15, 5), unitData, direction, 1); unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(20, 0), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(15, -5), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(15, -10), unitData, direction, 1); unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(20, -15), unitData, direction, 1); //the target thing probably is still borken? unitData = _unitRepository.GetById("Archer"); SpawnAPoint(alliance, new WorldPosition(20, -7), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(25, 8), unitData, direction, 1); unitData = _unitRepository.GetById("SplashShielder"); SpawnAPoint(alliance, new WorldPosition(25, -2), unitData, direction, 1); unitData = _unitRepository.GetById("SplashShielder"); SpawnAPoint(alliance, new WorldPosition(25, 8), unitData, direction, 1); }
public void Decode(ByteStream stream) { this.m_allianceId = stream.ReadLong(); this.m_allianceName = stream.ReadString(900000); this.m_allianceBadgeId = stream.ReadInt(); this.m_allianceType = (AllianceType)stream.ReadInt(); this.m_memberCount = stream.ReadInt(); this.m_score = stream.ReadInt(); this.m_duelScore = stream.ReadInt(); this.m_requiredScore = stream.ReadInt(); this.m_requiredDuelScore = stream.ReadInt(); this.m_winWarCount = stream.ReadInt(); this.m_lostWarCount = stream.ReadInt(); this.m_drawWarCount = stream.ReadInt(); this.m_localeData = ByteStreamHelper.ReadDataReference(stream); this.m_warFrequency = stream.ReadInt(); this.m_originData = ByteStreamHelper.ReadDataReference(stream); this.m_expPoints = stream.ReadInt(); this.m_expLevel = stream.ReadInt(); this.m_consecutiveWinWarCount = stream.ReadInt(); this.m_publicWarLog = stream.ReadBoolean(); stream.ReadInt(); this.m_amicalWarEnabled = stream.ReadBoolean(); }
private void CreateArmy1(AllianceType alliance, float heading) { var direction = MathExtensions.FromHeading(heading + 90f); // first line gets the unit registry data var unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(-20, 10), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(-20, 5), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(-25, 0), unitData, direction, 1); unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(-20, -5), unitData, direction, 1); unitData = _unitRepository.GetById("SplashShielder"); SpawnAPoint(alliance, new WorldPosition(-20, -10), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(-20, -15), unitData, direction, 1); unitData = _unitRepository.GetById("Barbarian"); SpawnAPoint(alliance, new WorldPosition(-20, -7), unitData, direction, 1); unitData = _unitRepository.GetById("Giant"); SpawnAPoint(alliance, new WorldPosition(-20, 8), unitData, direction, 1); //unitData = _unitRegistry[3]; //point += MathExtensions.FromHeading(heading)*3f; //SpawnAPoint(alliance, point, unitData, direction, 1); }
static void Min(string[] args) { HeuristicData.Set(args); bool isFirstTurn = true; string[] inputs; int numSites = int.Parse(Console.ReadLine()); for (int i = 0; i < numSites; i++) { inputs = Console.ReadLine().Split(' '); int siteId = int.Parse(inputs[0]); int x = int.Parse(inputs[1]); int y = int.Parse(inputs[2]); int radius = int.Parse(inputs[3]); BuildingLocation newLocation = new BuildingLocation(siteId, x, y, radius); GameData.m_buildingMap[siteId] = newLocation; GameData.m_buildingList.Add(newLocation); } // game loop while (true) { ++GameData.m_gameTurn; inputs = Console.ReadLine().Split(' '); int gold = int.Parse(inputs[0]); int touchedSite = int.Parse(inputs[1]); // -1 if none GameData.m_amountOfGold = gold; GameData.m_touchedSite = touchedSite; for (int i = 0; i < numSites; i++) { inputs = Console.ReadLine().Split(' '); int siteId = int.Parse(inputs[0]); int goldRemaining = int.Parse(inputs[1]); // -1 if unknown int maxMineSize = int.Parse(inputs[2]); // -1 if unknown int structureType = int.Parse(inputs[3]); // -1 = No structure, 0 = Goldmine, 1 = Tower, 2 = Barracks int owner = int.Parse(inputs[4]); // -1 = No structure, 0 = Friendly, 1 = Enemy int param1 = int.Parse(inputs[5]); int param2 = int.Parse(inputs[6]); //Refresh all location data BuildingLocation currentLocation = GameData.m_buildingMap[siteId]; currentLocation.m_allianceType = owner == -1 ? AllianceType.NEUTRAL : owner == 0 ? AllianceType.FRIENDLY : AllianceType.HOSTILE; currentLocation.m_remainingBuildTime = param1; currentLocation.m_goldRemaining = goldRemaining; currentLocation.m_maxYield = maxMineSize; currentLocation.m_level = param1; BuildingType updatedType = Helpers.GetBuildingTypeFromString(structureType); bool currentLocationTypeIsBarracks = (int)currentLocation.m_buildingType >= 3; if ((int)updatedType >= 3 && !currentLocationTypeIsBarracks) { currentLocation.m_buildingType = updatedType; } else if ((int)updatedType < 3) { currentLocation.m_buildingType = updatedType; } } List <Unit> unitList = new List <Unit>(); int numUnits = int.Parse(Console.ReadLine()); for (int i = 0; i < numUnits; i++) { inputs = Console.ReadLine().Split(' '); int x = int.Parse(inputs[0]); int y = int.Parse(inputs[1]); int owner = int.Parse(inputs[2]); // 0 = FRIENDLY , 1 = ENEMY int unitType = int.Parse(inputs[3]); // -1 = QUEEN, 0 = KNIGHT, 1 = ARCHER int health = int.Parse(inputs[4]); //Create all units that exist this frame AllianceType type = owner == 0 ? AllianceType.FRIENDLY : AllianceType.HOSTILE; UnitType unitTypeEnum = unitType == -1 ? UnitType.QUEEN : unitType == 0 ? UnitType.KNIGHT : UnitType.ARCHER; Unit newUnit = new Unit(x, y, type, unitTypeEnum, health); if (unitTypeEnum == UnitType.QUEEN) { if (type == AllianceType.FRIENDLY) { GameData.m_friendlyQueen = newUnit; } else { GameData.m_enemyQueen = newUnit; } } unitList.Add(newUnit); } if (isFirstTurn) { Vector2 distanceBetweenQueens = Vector2.GetDistance(GameData.m_friendlyQueen.m_position, GameData.m_enemyQueen.m_position); float lengthBetweenQueens = distanceBetweenQueens.GetLengthSqr(); GameData.m_hubPosition = GameData.m_friendlyQueen.m_position + (distanceBetweenQueens.Normalized() * (lengthBetweenQueens / 10)); StrategyDirector.CreateEvaluationSystem(); } if (GameData.m_gameTurn < HeuristicData.TURNS_FOR_MIDGAME && Vector2.GetDistance(GameData.m_hubPosition, GameData.m_enemyQueen.m_position).GetLength() < Math.Pow(HeuristicData.QUEEN_IS_RUSHING_DISTANCE, 2)) { Vector2 distance = Vector2.GetDistance(GameData.m_hubPosition, GameData.m_centerMap); //GameData.m_hubPosition = GameData.m_centerMap + distance; //StrategyDirector.CreateEvaluationSystem(); } GameData.m_unitList = unitList; // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); string queenInstructions = ""; string trainingInstructions = ""; StrategyManager.Execute(out queenInstructions, out trainingInstructions); // First line: A valid queen action // Second line: A set of training instructions Console.WriteLine(queenInstructions); Console.WriteLine(trainingInstructions); if (isFirstTurn) { isFirstTurn = false; } StrategyManager.OutputTurnData(); } }
public void SetAllianceType(AllianceType value) { this.m_allianceType = value; }
public object SelectAlliance(AllianceType alliance, int bonus) { return(this.Call("PlayerService", "selectAlliance", new object[] { "AllianceType", alliance, bonus })); }
private void SpawnAPoint(AllianceType alliance, WorldPosition point, UnitData unitData) { var command = _spawnUnitCommandFactory.Create(unitData, alliance, point); _commandProcessor.AddCommand(command); }