Пример #1
0
    private void Start()
    {
        au           = GetComponent <AudioSource>();
        interactable = GetComponentInParent <Interactable>();
        assembler    = GetComponentInParent <Assembler.AssemblerComponent>();

        interactable.onAttachedToHand   += Interactable_onAttachedToHand;
        interactable.onDetachedFromHand += Interactable_onDetachedFromHand;
        if (assembler != null)
        {
            assembler.onAttached += Assembler_onAttached;
        }
    }
Пример #2
0
        private void Start()
        {
            if (faker)
            {
                return;
            }

            if (previewHolo)
            {
                previewHolo.SetActive(true);
            }

            rb             = GetComponent <Rigidbody>();
            pointColliders = new AssemblerPoint[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                GameObject g = new GameObject("pt_" + i);
                pointColliders[i]                    = (AssemblerPoint)g.AddComponent <AssemblerPoint>();
                pointColliders[i].radius             = rad;
                pointColliders[i].transform.parent   = transform;
                pointColliders[i].transform.position = transform.TransformPoint(points[i].point);
                pointColliders[i].transform.rotation = Quaternion.LookRotation(transform.TransformDirection(points[i].normal), transform.up);
                pointColliders[i].comp               = this;
                pointColliders[i].ID                 = points[i].ID;
                pointColliders[i].gameObject.layer   = 1; // set it to transparentFX layer, so they don't collide with eachother
            }


            if (core)
            {
                coreComp = this;
            }
            else
            {
                interactable = GetComponent <Interactable>();
            }
        }