protected void SpawnInhibitor(string name) { uint netId = BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(name)); Inhibitor inhibitor = new Inhibitor(netId, BuildingRecord.GetBuildingRecord(this.Game.Map.Id, name), Game.Map.Record.GetObject(name)); inhibitor.DefineGame(Game); Game.AddUnitToTeam(inhibitor, BuildingProvider.Instance.GetTeamId(name)); Game.Map.AddUnit(inhibitor); }
protected void SpawnNexus(string name) { uint netId = BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(name)); Nexus nexus = new Nexus(netId, BuildingRecord.GetBuildingRecord(this.Game.Map.Id, name), Game.Map.Record.GetObject(name)); nexus.DefineGame(Game); Game.AddUnitToTeam(nexus, BuildingProvider.Instance.GetTeamId(name)); Game.Map.AddUnit(nexus); }
protected void SpawnAITurret(string turretName, string aiUnitRecordName, string customAIUnitRecord = null) { AIUnitRecord aIUnitRecord = AIUnitRecord.GetAIUnitRecord(customAIUnitRecord != null ? customAIUnitRecord : aiUnitRecordName); MapObjectRecord objectRecord = Game.Map.Record.GetObject(turretName); if (objectRecord == null) { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "the GameObjectRecord do not exist."), MessageState.WARNING); return; } if (aIUnitRecord == null) { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "the AIUnitRecord do not exist."), MessageState.WARNING); return; } string fullName = turretName + BuildingProvider.TOWER_SUFFIX; var teamId = BuildingProvider.Instance.GetTeamId(turretName); if (teamId != TeamId.UNKNOWN) { uint netId = (uint)(BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(fullName))); AITurret turret = new AITurret(netId, aIUnitRecord, objectRecord, BuildingRecord.GetBuildingRecord(Game.Map.Id, turretName), BuildingProvider.TOWER_SUFFIX); turret.DefineGame(Game); Game.AddUnitToTeam(turret, teamId); Game.Map.AddUnit(turret); if (customAIUnitRecord != null) { turret.AddStackData(customAIUnitRecord, 0, false, true, true, false); } } else { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "Unable to find a team."), MessageState.WARNING); } }