コード例 #1
0
        // Depreciated VVV
        public object ExecuteFunction(string funcname, object[] args, InputContext context)
        {
            switch (funcname)
            {
            case "f:sin":
                return(Sin(ExCasts.GetObjectAsDouble(args[0])));

            case "f:cos":
                return(Cos(ExCasts.GetObjectAsDouble(args[0])));

            case "f:tan":
                return(Tan(ExCasts.GetObjectAsDouble(args[0])));

            case "f:abs":
                return(Abs(ExCasts.GetObjectAsDouble(args[0])));

            case "f:min":
                return(Min(ExCasts.GetObjectsAsDoubleUnwrapping(args)));

            case "f:max":
                return(Max(ExCasts.GetObjectsAsDoubleUnwrapping(args)));

            case "f:avg":
                return(Avg(ExCasts.GetObjectsAsDoubleUnwrapping(args)));

            default:
                throw new Exception("Func '" + funcname + "' not found in library '" + GetLibraryName() + "'");
            }
        }
コード例 #2
0
        public object ExecuteFunction(string funcname, object[] args, InputContext context)
        {
            switch (funcname)
            {
            case "f:random":
                return(RandomDouble(ExCasts.GetObjectAsDouble(args[0]), ExCasts.GetObjectAsDouble(args[1]), context.Random));

            case "f:randomint":
                return(RandomInt(ExCasts.GetObjectAsInt(args[0]), ExCasts.GetObjectAsInt(args[1]), context.Random));

            case "f:roll":
                return(Roll(ExCasts.GetObjectAsInt(args[0]), ExCasts.GetObjectAsInt(args[1]), context.Random));

            default:
                throw new Exception("Func '" + funcname + "' not found in library '" + GetLibraryName() + "'");
            }
        }