コード例 #1
0
        public LuaArgs rumble(LuaArgs args)
        {
            var strength = args.GetFloat(0);
            var duration = args.GetFloat(1);

            if (duration < 0.0f || duration > 5.0f)
            {
                throw new LuaError("Duration must be within 0 and 5 seconds");
            }
            m_state.Rumble(strength, duration);
            return(LuaArgs.Empty);
        }
コード例 #2
0
        public LuaArgs setSkyOrigin(LuaArgs args)
        {
            var x   = args.GetFloat(0);
            var y   = args.GetFloat(1);
            var z   = args.GetFloat(2);
            var sky = m_state.Game.Sky;

            if (sky != null)
            {
                sky.ForegroundModelTransform = Matrix4.CreateTranslation(x, y, z);
            }
            return(LuaArgs.Empty);
        }
コード例 #3
0
ファイル: LuaPalette.cs プロジェクト: xiuzhifu/Redirection
        public LuaArgs setColor(LuaArgs args)
        {
            int   n = args.GetInt(0);
            float r = args.GetFloat(1);
            float g = args.GetFloat(2);
            float b = args.GetFloat(3);

            CheckWritable();
            uint rb    = (uint)(ClampColorComponent(r) * 255.0f) & 0xff;
            uint gb    = (uint)(ClampColorComponent(g) * 255.0f) & 0xff;
            uint bb    = (uint)(ClampColorComponent(b) * 255.0f) & 0xff;
            uint color = (rb << 24) + (gb << 16) + (bb << 8) + 255;

            if (n >= 0 && n < Palette.Size)
            {
                Palette[n] = color;
            }
            return(LuaArgs.Empty);
        }
コード例 #4
0
        public LuaArgs stopMusic(LuaArgs args)
        {
            var transition = args.IsNil(0) ? 1.0f : args.GetFloat(1);

            if (transition < 0.0f)
            {
                throw new LuaError("Transition duration must be positive");
            }
            m_state.PlayMusic(null, transition, false);
            return(LuaArgs.Empty);
        }
コード例 #5
0
        public LuaArgs playMusic(LuaArgs args)
        {
            var path       = args.IsNil(0) ? null : args.GetString(0);
            var loop       = args.IsNil(1) ? true : args.GetBool(1);
            var transition = args.IsNil(2) ? 1.0f : args.GetFloat(2);

            if (transition < 0.0f)
            {
                throw new LuaError("Transition duration must be positive");
            }
            m_state.PlayMusic(path, transition, loop);
            return(LuaArgs.Empty);
        }