private void LoadTeamVisuals(GameState state, int ti) { RTSTeam team = state.teams[ti]; // Create Unit Graphics var ums = ti == teamIndex ? FriendlyUnitModels : NonFriendlyUnitModels; for (int i = 0; i < team.Race.ActiveUnits.Length; i++) { int ui = team.Race.ActiveUnits[i].Index; RTSUnitData uData = team.Race.Units[ui]; RTSUnitModel uModel = RTSUnitDataParser.ParseModel(this, new FileInfo(uData.InfoFile), team.Race); uModel.Hook(this, state, ti, team.Race.ActiveUnits[i].Index); uModel.ColorScheme = team.ColorScheme; ums.Add(uModel); } // Create Building Graphics var bms = ti == teamIndex ? FriendlyBuildingModels : NonFriendlyBuildingModels; for (int i = 0; i < team.Race.ActiveBuildings.Length; i++) { RTSBuildingModel bModel = RTSBuildingDataParser.ParseModel(this, new FileInfo(team.Race.ActiveBuildings[i].InfoFile), team.Race); bModel.Hook(this, state, ti, teamIndex, team.Race.ActiveBuildings[i].Index); bModel.ColorScheme = team.ColorScheme; bms.Add(bModel); } }
public void Build(RTSRenderer renderer, string rootPath, string model, string[] tex) { using(var sModel = File.OpenRead(Path.Combine(rootPath, model))) { View = new RTSBuildingModel(renderer, sModel); } View.ModelTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[0])); View.ColorCodeTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[1])); }