Пример #1
0
        private void returnToInit(InteractionController iControl)
        {
            if (iControl != null)
            {
                iControl.ReleaseGrasp();
            }

            // With new system does not need to be handled
            //gameObject.transform.localPosition = initLocalPos;
            //gameObject.transform.localRotation = initLocalRot;

            //if (aBehave.anchor != null)
            //{
            aBehave.TryAttachToNearestAnchor();
            //}
        }
 private void onGraspEnd()
 {
     if (anchorControl.TryAttachToNearestAnchor())
     {
         this.transform.parent = anchorControl.anchor.transform;
     }
     //float distanceToAnchor = Vector3.Distance(this.transform.position, anchor.transform.position);
     //if (distanceToAnchor < 0.3F && toolbelt.isOpen) {
     //  _state = BuildingPrimitiveState.Anchored;
     //  this.transform.parent = anchor.transform;
     //}
     //else {
     //  _state = BuildingPrimitiveState.Placed;
     //  this.transform.parent = null;
     //}
 }
Пример #3
0
    private IEnumerator LateAttach(float time)
    {
        yield return new WaitForSeconds(time);
        bool wasVisible = anchor.gameObject.activeSelf;
        if (!wasVisible)
        {
            anchor.gameObject.SetActive(true);
        }

        var nearestValidAnchor = anchorableBehaviour.GetNearestValidAnchor(false);
        if (nearestValidAnchor != null)
        {
            transform.position = nearestValidAnchor.transform.position;
            anchorableBehaviour.TryAttachToNearestAnchor();
        }

        if (!wasVisible)
        {
            anchor.gameObject.SetActive(false);
        }
    }