Exemple #1
0
 public KsAnimAnimator(string filename, float duration, bool skipFixed)
 {
     _duration  = duration;
     _skipFixed = skipFixed;
     _filename  = filename;
     _original  = File.Exists(_filename) ? KsAnim.FromFile(_filename) : KsAnim.CreateEmpty();
     _watcher   = SimpleDirectoryWatcher.WatchFile(filename, Reload);
 }
Exemple #2
0
        private void InitializeDriver()
        {
            if (_driverSet)
            {
                return;
            }
            _driverSet = true;

            if (_driverHierarchyFilename == null)
            {
                _driverHierarchyFilename = Path.Combine(RootDirectory, "driver_base_pos.knh");
                _driverHierarchyWatcher  = SimpleDirectoryWatcher.WatchFile(_driverHierarchyFilename, () => {
                    _driver?.AlignNodes(Knh.FromFile(_driverHierarchyFilename));
                });
            }

            var driver = _carData.GetDriverDescription();

            if (driver == null)
            {
                return;
            }

            var contentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(RootDirectory));

            if (contentDirectory == null)
            {
                return;
            }

            var driversDirectory = Path.Combine(contentDirectory, "driver");

            _driverModelFilename = Path.Combine(driversDirectory, driver.Name + ".kn5");
            _driverModelWatcher  = SimpleDirectoryWatcher.WatchFile(_driverModelFilename, ReloadDriverModel);
            LoadDriverModel();

            ObjectsChanged?.Invoke(this, EventArgs.Empty);
        }