Пример #1
0
        protected void addPeriodic(InitTable config)
        {
            SoundDescriptor desc = new SoundDescriptor();

            desc.filename  = config.findData <string>("sound");
            desc.is3d      = true;
            desc.isLooping = false;
            desc.priority  = Priority.BACKGROUND_FX;

            Sound snd = new Sound(desc);

            snd.relativePosition = true;

            Periodic pr = new Periodic(this);

            pr.sound = snd;

            Random rand = new Random();

            pr.minPitch = config.findDataOr <float>("pitch.min", 0.8f);
            pr.maxPitch = config.findDataOr <float>("pitch.max", 1.2f);
            pr.minDelay = config.findDataOr <float>("delay.min", 1.0f);
            pr.maxDelay = config.findDataOr <float>("delay.min", 5.0f);
            pr.maxRange = config.findDataOr <Vector3>("maxRange", new Vector3(20, 20, 20));

            pr.nextTime = rand.randomInRange(pr.minDelay, pr.maxDelay);

            myPeriodics.Add(pr);
        }
Пример #2
0
        protected void addBackground(InitTable config)
        {
            SoundDescriptor desc = new SoundDescriptor();

            desc.filename  = config.findData <string>("sound");
            desc.is3d      = false;
            desc.isLooping = true;
            desc.priority  = Priority.BACKGROUND_FX;
            Sound snd = new Sound(desc);

            Background bg = new Background(this);

            bg.sound = snd;

            Random rand = new Random();

            bg.pitch.minVal     = config.findDataOr <float>("pitch.minVal", 0.8f);
            bg.pitch.maxVal     = config.findDataOr <float>("pitch.maxVal", 1.2f);
            bg.pitch.currentVal = rand.randomInRange(bg.pitch.minVal, bg.pitch.maxTime);
            bg.pitch.minTime    = config.findDataOr <float>("pitch.minTime", 1.0f);
            bg.pitch.maxTime    = config.findDataOr <float>("pitch.maxTime", 5.0f);
            bg.pitch.reset();

            bg.volume.minVal     = config.findDataOr <float>("volume.minVal", 0.8f);
            bg.volume.maxVal     = config.findDataOr <float>("volume.maxVal", 1.2f);
            bg.volume.currentVal = rand.randomInRange(bg.volume.minVal, bg.volume.maxTime);
            bg.volume.minTime    = config.findDataOr <float>("volume.minTime", 1.0f);
            bg.volume.maxTime    = config.findDataOr <float>("volume.maxTime", 5.0f);
            bg.volume.reset();

            myBackgrounds.Add(bg);
        }
Пример #3
0
        public SoundScape(string filename)
        {
            Initializer init = new Initializer(filename);

            InitTable soundscape = init.findData <InitTable>("Soundscape");

            volume = init.findDataOr <float>("volume", 1.0f);

            InitTable backgrounds = soundscape.findDataOr <InitTable>("Backgrounds", null);
            InitTable periodics   = soundscape.findDataOr <InitTable>("Periodics", null);

            //stupid lua tables go from 1-count
            for (int i = 1; i <= backgrounds.count(); i++)
            {
                InitTable bg = backgrounds.findData <InitTable>(i);
                addBackground(bg);
            }

            for (int i = 1; i <= periodics.count(); i++)
            {
                InitTable per = periodics.findData <InitTable>(i);
                addPeriodic(per);
            }
        }
Пример #4
0
        public void init(InitTable init)
        {
            String path = (String)init.findDataOr("shaderComponents", "../data/shaders");

            //read in the scripts to support the entity system
            //may need to move this to a resource
            myVm.doFile(path + "/shaderCompiler.lua");

            //read in all the entity files
            foreach (String file in Directory.GetFiles(path))
            {
                if (file.Contains(".comp") == true)
                {
                    Debug.print("Shader compiler evaluating component file: {0}", file);
                    myVm.doFile(file);
                }
            }

            myVsCompiler = myVm.findObject("compileVertexShader");
            myGsCompiler = myVm.findObject("compileGeometryShader");
            myPsCompiler = myVm.findObject("compilePixelShader");

            //createFileWatcher(path);
        }