private AssemblyArgumentReferenceError CheckArgumentValues(IUdonHeap heap, List <uint> stack, string assembly, string arguments, out string detail)
        {
            var desiredArgs = arguments.Trim('_').Split('_');
            var phrases     = Regex.Split(assembly, "__");
            var args        = phrases[2].Split('_');
            // 引数の構造的に最後の型一致が求める引数になる Physics.*Cast の引数構造がある前提
            var hit = Array.LastIndexOf(args, desiredArgs[0]);

            if (desiredArgs.Length == 2)
            {
                // *Cast は 2引数セットで揃っている
                if (args[hit + 1] == desiredArgs[1])
                {
                    // 見つかった
                    var maxDistance = heap.GetHeapVariable <float>(stack[hit]);   // distance
                    var layerMask   = heap.GetHeapVariable <int>(stack[hit + 1]); // layermask
                    if (maxDistance > _maxDistance)
                    {
                        // MaxDistanceエラー
                        detail = maxDistance.ToString(CultureInfo.InvariantCulture);
                        return(AssemblyArgumentReferenceError.MaxDistanceError);
                    }

                    if (layerMask != _layerMask)
                    {
                        // layerMaskエラー
                        detail = layerMask.ToString();
                        return(AssemblyArgumentReferenceError.LayerMaskError);
                    }
                }
                else
                {
                    // 引数エラー
                    detail = "";
                    return(AssemblyArgumentReferenceError.InvalidArguments);
                }
            }
            else
            {
                // LineCastの場合のみ
                var layerMask = heap.GetHeapVariable <int>(stack[hit]); // layermask
                if (layerMask != _layerMask)
                {
                    // layerMaskエラー
                    detail = layerMask.ToString();
                    return(AssemblyArgumentReferenceError.LayerMaskError);
                }
            }

            // 何もない
            detail = "";
            return(AssemblyArgumentReferenceError.NoErrors);
        }
Beispiel #2
0
    private static void __Instantiate__UnityEngineGameObject__UnityEngineGameObject(IUdonHeap heap, uint[] parameterAddresses)
    {
        GameObject original = heap.GetHeapVariable <GameObject>(parameterAddresses[0]);
        GameObject clone    = Object.Instantiate(original);

        heap.SetHeapVariable(parameterAddresses[1], clone);
    }
Beispiel #3
0
        private void __Instantiate__UnityEngineGameObject__UnityEngineGameObject(IUdonHeap heap, uint[] parameterAddresses)
        {
            GameObject original = heap.GetHeapVariable <GameObject>(parameterAddresses[0]);

            #if !UDON_DISABLE_SECURITY
            _blacklist.FilterBlacklisted(ref original);
            #endif

            GameObject clone = Object.Instantiate(original);
            heap.SetHeapVariable(parameterAddresses[1], clone);
        }
Beispiel #4
0
        private void __Instantiate__UnityEngineGameObject__UnityEngineGameObject(IUdonHeap heap, Span <uint> parameterAddresses)
        {
            GameObject original = heap.GetHeapVariable <GameObject>(parameterAddresses[0]);

            #if !UDON_DISABLE_SECURITY
            _blacklist.FilterBlacklisted(ref original);
            #endif

            GameObject clone = Object.Instantiate(original);
            foreach (UdonBehaviour udonBehaviour in clone.GetComponentsInChildren <UdonBehaviour>(true))
            {
                UdonManager.Instance.RegisterUdonBehaviour(udonBehaviour);
            }

            heap.SetHeapVariable(parameterAddresses[1], clone);
        }