Пример #1
0
        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);
            }
        }
Пример #2
0
        private void UnitLoader(object _fi)
        {
            FileInfo fi = _fi as FileInfo;

            GameState state = new GameState();

            state.teams[0] = new RTSTeam(0, RTSInputType.None);
            state.UpdateActiveTeams();
            RTSUnitData _unitData = RTSUnitDataParser.ParseData(GameEngine.Scripts, fi, 0);

            state.teams[0].Race.Units[0] = _unitData;
            state.teams[0].Race.UpdateActiveUnits();
            RTSUnitModel _unitModel = RTSUnitDataParser.ParseModel(renderer, fi, state.teams[0].Race);

            _unitModel.Hook(renderer, state, 0, 0);
            RTSUnit _unit = new RTSUnit(state.teams[0], state.teams[0].Race.Units[0], Vector2.Zero);

            _unit.Height = 0;
            _unitModel.OnUnitSpawn(_unit);

            // Create The Full Animation Loop
            _unit.AnimationController = new BlankAnimController(0, (_unitModel.AnimationTexture.Height / 3) - 1, 30f);

            // Make Sure To Only Modify At A Specific Point
            lock (drawLock) {
                // Check Previous Dispose
                if (unit != null)
                {
                    DisposeUnit();
                }

                // Now Set Data
                unitData  = _unitData;
                unit      = _unit;
                unitModel = _unitModel;
            }
        }