Exemple #1
0
        public void Init(PenManager manager)
        {
            penManager = manager;

            inkPool.name         = inkPoolName;
            colliderHolder.layer = inkLayer;

            inkPrefab.SetActive(false);
            eraser.gameObject.SetActive(false);

            pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
            pickup.InteractionText = nameof(Pen);
            pickup.UseText         = "Draw";

            // PenManager : Manager, EraserManager : Manager, Init(Manager manager)
            eraser.Init(null);
        }
Exemple #2
0
        public void Init(PenManager penManager, Settings settings)
        {
            this.penManager = penManager;

            inkLayer    = settings.inkLayer;
            inkPrefix   = settings.inkPrefix;
            inkPoolName = settings.inkPoolName;

            inkWidth = penManager.inkWidth;

            colliderPrefab.gameObject.layer = inkLayer;
            inkPool.name = inkPoolName;

            {
#if UNITY_ANDROID
                var material = penManager.questInkMaterial;
                trailRenderer.widthMultiplier = inkWidth;
#else
                var material = penManager.pcInkMaterial;
                if (material.shader == settings.roundedTrail)
                {
                    trailRenderer.widthMultiplier = 0f;
                    material.SetFloat("_Width", inkWidth);
                }
                else
                {
                    trailRenderer.widthMultiplier = inkWidth;
                }
#endif
                trailRenderer.material      = material;
                trailRenderer.colorGradient = penManager.colorGradient;
            }

            {
#if UNITY_ANDROID
                var material = penManager.questInkMaterial;
                linePrefab.widthMultiplier = inkWidth;
#else
                var material = penManager.pcInkMaterial;
                if (material.shader == settings.roundedTrail)
                {
                    linePrefab.widthMultiplier = 0f;
                    material.SetFloat("_Width", inkWidth);
                }
                else
                {
                    linePrefab.widthMultiplier = inkWidth;
                }
#endif
                linePrefab.material      = material;
                linePrefab.colorGradient = penManager.colorGradient;
            }

            pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
            pickup.InteractionText = nameof(Pen);
            pickup.UseText         = "Draw";

            objectSync = (VRCObjectSync)GetComponent(typeof(VRCObjectSync));

            settings.inkPool = inkPool;
            eraser.Init(null, settings);
            eraser.gameObject.SetActive(false);
            eraser.transform.SetParent(inkPosition);
            eraser.transform.localPosition = Vector3.zero;
            eraser.transform.localRotation = Quaternion.identity;
            eraser.transform.localScale    = Vector3.one * eraserScale;
        }