Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
 public void LoadUnit(Dictionary <string, ReflectedScript> d, int index, string rootPath, string file)
 {
     Units[index] = RTSUnitDataParser.ParseData(d, new FileInfo(Path.Combine(rootPath, file)), index);
 }