Beispiel #1
0
    protected override void OnSelectEntered(SelectEnterEventArgs args)
    {
        base.OnSelectEntered(args);
        // need to force hand to go on the string otherwise it could select something else
        // VRDebug.Log("Forcing hand string connection");
        // if (bow.offHand.selectTarget != null && bow.offHand.selectTarget != bowString)
        // {
        //     interactionManager.CancelInteractorSelection(bow.offHand);
        // }
        // interactionManager.SelectEnter(bow.offHand, bowString);
        // interactionManager.ForceSelect(bow.offHand, bowString);

        if (!(args.interactable is ArrowInteractable))
        {
            VRDebug.Log("wrong interaction " + args.interactable.name, 5);
        }

        // get arrow
        currentArrow = args.interactable as ArrowInteractable;
        if (bow.debugLog)
        {
            VRDebug.Log("Arrow '" + currentArrow.gameObject.name + "' notched");
        }
        isArrowArmed = false;
        currentArrow.ArrowSet();
        currentArrow.SetBow(bow);
        bow.ArrowSet();
    }
Beispiel #2
0
    // protected Collider col;

    protected virtual void Awake()
    {
        typeName          = "Base Arrow";
        rb                = GetComponent <Rigidbody>();
        arrowInteractable = GetComponent <ArrowInteractable>();
        // col = GetComponent<Collider>();
        launched = false;
        stopped  = false;
        SetPhysicsEnabled(false);
    }
Beispiel #3
0
 protected override void OnSelectExited(SelectExitEventArgs args)
 {
     base.OnSelectExited(args);
     if (bow.debugLog)
     {
         VRDebug.Log("Arrow exited notch");
     }
     currentArrow.ArrowUnSet();
     bow.ArrowUnSet();
     currentArrow = null;
 }
Beispiel #4
0
    protected void CreateMenuItem(int i)
    {
        // menu
        var menuItemgo = Instantiate(menuItemPrefab, transform);

        menuItems.Insert(i, menuItemgo);
        // arrow
        ArrowInteractable arrowPrefab = (ArrowInteractable)arrowPrefabs[i];
        var arrowGo = Instantiate(arrowPrefab, menuItemgo.transform);

        arrowGo.name = arrowPrefab.name + "_" + i;
        arrowGo.transform.localPosition = Vector3.zero;
        arrowGo.transform.localScale    = Vector3.one * displayModelArrowScale / displayModelScale;
        arrowGo.transform.localRotation = Quaternion.Euler(displayRotation);
        ArrowInteractable arrow = arrowGo.GetComponent <ArrowInteractable>();

        arrow.ArrowDisplay(true);
        arrow.selectEntered.AddListener((args) => { ArrowTaken(i, args); });
        arrowsSpawned.Insert(i, arrow);

        UpdateMenuPositions();
        UpdateSel();
    }