/// <summary>
        /// Initializes a user-defined function.
        /// </summary>
        /// <param name="name"> The name of the function. </param>
        /// <param name="args"> The names of the arguments. </param>
        /// <param name="bodyText"> The source code for the function body. </param>
        /// <param name="generatedMethod"> A delegate which represents the body of the function. </param>
        /// <param name="strictMode"> <c>true</c> if the function body is strict mode; <c>false</c> otherwise. </param>
        /// <param name="hasInstancePrototype"> <c>true</c> if the function should have a valid
        /// "prototype" property; <c>false</c> if the "prototype" property should be <c>null</c>. </param>
        private void Init(string name, IList <ArgVariable> args, FunctionMethodGenerator gen, bool strictMode, bool hasInstancePrototype)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (args == null)
            {
                args = new ArgVariable[0];
            }
            this.Arguments  = args;
            this.Generator  = gen;
            this.StrictMode = strictMode;

            Name   = name;
            Length = args.Count;

            /*
             * // The empty function doesn't have an instance prototype.
             * if (hasInstancePrototype == true)
             * {
             *      this.FastSetProperty("prototype",ObjectInstance.OnConstruct(Engine), PropertyAttributes.Writable);
             #warning this is incorrect; instanceProto is actually the (globally shared) Object proto.
             *      // this.InstancePrototype.AddProperty("constructor", this, PropertyAttributes.NonEnumerable);
             * }
             */
        }
    public void OnDebugClick(GameObject target)
    {
        Machine.Initialize();

        Machine.FunctionCall(ArgVariable.CreateFunctionName("Vector3", "Move", "Vector3", "Vector3", "float"),
                             CustomArgVariable.Create(new Vector3(0.0f, 0.0f, 0.0f)),
                             CustomArgVariable.Create(new Vector3(10.0f, 1.0f, 1.0f)),
                             CustomArgVariable.Create(1.0f));
        StartCoroutine(Machine.Routin((cpu) => PreAction(cpu), (cpu) => Move(cpu, target), (cpu) => Move(cpu, target)));
    }
Exemple #3
0
 /// <summary>
 /// サイズの取得
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="number"></param>
 /// <returns></returns>
 public new static int GetArgSize <T>(int number = 1)
 {
     if (typeof(T) == typeof(Vector2))
     {
         return(2);
     }
     else if (typeof(T) == typeof(Vector2[]))
     {
         return(2 * number);
     }
     else if (typeof(T) == typeof(Vector3))
     {
         return(3);
     }
     else if (typeof(T) == typeof(Vector3[]))
     {
         return(3 * number);
     }
     else if (typeof(T) == typeof(Vector4))
     {
         return(4);
     }
     else if (typeof(T) == typeof(Vector4[]))
     {
         return(4 * number);
     }
     else if (typeof(T) == typeof(Quaternion))
     {
         return(4);
     }
     else if (typeof(T) == typeof(Quaternion[]))
     {
         return(4 * number);
     }
     else if (typeof(T) == typeof(Color))
     {
         return(4);
     }
     else if (typeof(T) == typeof(Color[]))
     {
         return(4 * number);
     }
     return(ArgVariable.GetArgSize <T>(number));
 }