Beispiel #1
0
 public void openDoor(InteractionSystem system, FullBodyBipedEffector[] effector, InteractionObject obj)
 {
     foreach (FullBodyBipedEffector e in effector)
     {
         system.StartInteraction(e, obj, true);
     }
 }
Beispiel #2
0
    void Awake()
    {
        interactionSystem = GetComponent <InteractionSystem>();
        mAnim             = GetComponent <Animator>();

        recoil = GetComponent <Recoil>();
    }
        public MainWindow()
        {
            InitializeComponent();

            // initialize the EyeX Engine client library.
            system = InteractionSystem.Initialize(LogTarget.Trace);

            // create a context, register event handlers, and enable the connection to the engine.
            context = new InteractionContext(false);
            context.RegisterQueryHandlerForCurrentProcess(HandleQuery);
            context.RegisterEventHandler(HandleEvent);
            context.EnableConnection();

            // enable gaze point tracking over the entire window
            InitializeGlobalInteractorSnapshot();
            context.ConnectionStateChanged += (object s, ConnectionStateChangedEventArgs ce) =>
            {
                if (ce.State == ConnectionState.Connected)
                {
                    globalInteractorSnapshot.Commit((InteractionSnapshotResult isr) => { });
                }
            };

            // enable gaze triggered buttons
            gazeAwareButtons = new Dictionary<InteractorId, Button>();
            initalizeGazeAwareButtons();
        }
Beispiel #4
0
        public void Init(Transform casterRoot, Transform targetRoot)
        {
            m_CasterInteractionSystem = casterRoot.GetComponentInChildren <InteractionSystem>();
            m_TargetInteractionSystem = targetRoot.GetComponentInChildren <InteractionSystem>();

            if (!string.IsNullOrEmpty(casterObjName))
            {
                InteractionObject[] objs = casterRoot.GetComponentsInChildren <InteractionObject>(true);
                for (int i = 0; i < objs.Length; i++)
                {
                    if (objs[i].name == casterObjName)
                    {
                        m_CasterInteractionObj = objs[i];
                        break;
                    }
                }
            }

            if (!string.IsNullOrEmpty(targetObjName))
            {
                InteractionObject[] objs = targetRoot.GetComponentsInChildren <InteractionObject>(true);
                for (int i = 0; i < objs.Length; i++)
                {
                    if (objs[i].name == targetObjName)
                    {
                        m_TargetInteractionObj = objs[i];
                        break;
                    }
                }
            }
        }
Beispiel #5
0
 void Awake()
 {
     lookTarget.Disable();
     interactionSystem = GetComponent <InteractionSystem>();
     pickedUp          = false;
     nearItem          = false;
     destroyItems      = new Transform[2];
 }
Beispiel #6
0
 private void Awake()
 {
     if (Instance)
     {
         Destroy(this);
         Debug.Log("Selection system already exists");
     }
     Instance = this;
 }
Beispiel #7
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        player    = AC.KickStarter.player;
        ik        = player.GetComponent <FullBodyBipedIK>();
        intSystem = player.GetComponent <InteractionSystem>();


        rightHandTarget = player.GetComponent <InteractionSystem>().interactionObject.rHandTarget;
        leftHandTarget  = player.GetComponent <InteractionSystem>().interactionObject.lHandTarget;
    }
Beispiel #8
0
 public void Destroy(InteractionSystem interactionSystem)
 {
     if (!this.initiated)
     {
         return;
     }
     interactionSystem.OnInteractionStart  = (InteractionSystem.InteractionDelegate)Delegate.Remove(interactionSystem.OnInteractionStart, new InteractionSystem.InteractionDelegate(this.OnInteractionStart));
     interactionSystem.OnInteractionResume = (InteractionSystem.InteractionDelegate)Delegate.Remove(interactionSystem.OnInteractionResume, new InteractionSystem.InteractionDelegate(this.OnInteractionResume));
     interactionSystem.OnInteractionStop   = (InteractionSystem.InteractionDelegate)Delegate.Remove(interactionSystem.OnInteractionStop, new InteractionSystem.InteractionDelegate(this.OnInteractionStop));
 }
        public void PopulateValues(InteractionSystem intSystem)
        {
            //Load the correct interaction object list
            intSystem.interactionList = interactionList;

            //The data that needs to be stored
            intSystem.interactionObject = interactionObject;


            InteractionAnimation();
        }
Beispiel #10
0
            public void Update(InteractionSystem interactionSystem)
            {
                if (!this.initiated)
                {
                    return;
                }
                Vector3 vector = this.spherecastFrom.TransformDirection(this.raycastDirectionLocal);

                this.hit.point = this.spherecastFrom.position + vector;
                bool flag = this.FindWalls(vector);

                if (!this.inTouch)
                {
                    if (flag && Time.time > this.nextSwitchTime)
                    {
                        this.interactionObject.transform.parent = null;
                        interactionSystem.StartInteraction(this.effectorType, this.interactionObject, true);
                        this.nextSwitchTime = Time.time + this.minSwitchTime;
                        this.targetPosition = this.hit.point;
                        this.targetRotation = Quaternion.LookRotation(-this.hit.normal);
                        this.interactionObject.transform.position = this.targetPosition;
                        this.interactionObject.transform.rotation = this.targetRotation;
                    }
                }
                else
                {
                    if (!flag)
                    {
                        this.StopTouch(interactionSystem);
                    }
                    else if (!interactionSystem.IsPaused(this.effectorType) || this.sliding)
                    {
                        this.targetPosition = this.hit.point;
                        this.targetRotation = Quaternion.LookRotation(-this.hit.normal);
                    }
                    if (Vector3.Distance(this.interactionObject.transform.position, this.hit.point) > this.releaseDistance)
                    {
                        if (flag)
                        {
                            this.targetPosition = this.hit.point;
                            this.targetRotation = Quaternion.LookRotation(-this.hit.normal);
                        }
                        else
                        {
                            this.StopTouch(interactionSystem);
                        }
                    }
                }
                float b = (this.inTouch && (!interactionSystem.IsPaused(this.effectorType) || !(this.interactionObject.transform.position == this.targetPosition))) ? 1f : 0f;

                this.speedF = Mathf.Lerp(this.speedF, b, Time.deltaTime * 3f);
                this.interactionObject.transform.position = Vector3.Lerp(this.interactionObject.transform.position, this.targetPosition, Time.deltaTime * this.lerpSpeed * this.speedF);
                this.interactionObject.transform.rotation = Quaternion.Slerp(this.interactionObject.transform.rotation, this.targetRotation, Time.deltaTime * this.lerpSpeed * this.speedF);
            }
        public override void StartInteraction(InteractionSystem interactionSystem)
        {
            if (!m_enableInteraction)
            {
                return;
            }

            base.StartInteraction(interactionSystem);
            m_InteractionSystem = interactionSystem;
            m_InteractionSystem.StartInteraction(FullBodyBipedEffector.RightHand, m_finalIKInteractionObject, true);
        }
Beispiel #12
0
            // Cleaning up the delegates
            public void Destroy(InteractionSystem interactionSystem)
            {
                if (!initiated)
                {
                    return;
                }

                interactionSystem.OnInteractionStart  -= OnInteractionStart;
                interactionSystem.OnInteractionResume -= OnInteractionResume;
                interactionSystem.OnInteractionStop   -= OnInteractionStop;
            }
Beispiel #13
0
 public void Initiate(InteractionSystem interactionSystem)
 {
     this.raycastDirectionLocal            = this.spherecastFrom.InverseTransformDirection(this.interactionObject.transform.position - this.spherecastFrom.position);
     this.raycastDistance                  = Vector3.Distance(this.spherecastFrom.position, this.interactionObject.transform.position);
     interactionSystem.OnInteractionStart  = (InteractionSystem.InteractionDelegate)Delegate.Combine(interactionSystem.OnInteractionStart, new InteractionSystem.InteractionDelegate(this.OnInteractionStart));
     interactionSystem.OnInteractionResume = (InteractionSystem.InteractionDelegate)Delegate.Combine(interactionSystem.OnInteractionResume, new InteractionSystem.InteractionDelegate(this.OnInteractionResume));
     interactionSystem.OnInteractionStop   = (InteractionSystem.InteractionDelegate)Delegate.Combine(interactionSystem.OnInteractionStop, new InteractionSystem.InteractionDelegate(this.OnInteractionStop));
     this.hit.normal     = Vector3.forward;
     this.targetPosition = this.interactionObject.transform.position;
     this.targetRotation = this.interactionObject.transform.rotation;
     this.initiated      = true;
 }
        private void Start()
        {
            InteractionSystem expr_06 = this.interactionSystem;

            expr_06.OnInteractionStart = (InteractionSystem.InteractionDelegate)Delegate.Combine(expr_06.OnInteractionStart, new InteractionSystem.InteractionDelegate(this.OnStart));
            InteractionSystem expr_2D = this.interactionSystem;

            expr_2D.OnInteractionPause = (InteractionSystem.InteractionDelegate)Delegate.Combine(expr_2D.OnInteractionPause, new InteractionSystem.InteractionDelegate(this.OnPause));
            InteractionSystem expr_54 = this.interactionSystem;

            expr_54.OnInteractionResume = (InteractionSystem.InteractionDelegate)Delegate.Combine(expr_54.OnInteractionResume, new InteractionSystem.InteractionDelegate(this.OnDrop));
        }
Beispiel #15
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        InteractionSystem inSys = target as InteractionSystem;

        GUI.enabled = true; // you can press button in Edit and Play mods

        if (GUILayout.Button("Анализ недостающих частей"))
        {
            Something(inSys);
        }
    }
Beispiel #16
0
 private void StopTouch(InteractionSystem interactionSystem)
 {
     this.interactionObject.transform.parent = interactionSystem.transform;
     this.nextSwitchTime = Time.time + this.minSwitchTime;
     if (interactionSystem.IsPaused(this.effectorType))
     {
         interactionSystem.ResumeInteraction(this.effectorType);
     }
     else
     {
         this.speedF         = 0f;
         this.targetPosition = this.hit.point;
         this.targetRotation = Quaternion.LookRotation(-this.hit.normal);
     }
 }
Beispiel #17
0
        public override void StartInteraction(InteractionSystem interactionSystem)
        {
            base.StartInteraction(interactionSystem);
            Debug.Log("start box interraction");
            m_InteractionSystem = interactionSystem;
            m_InteractionSystem.StartInteraction(FullBodyBipedEffector.LeftHand, m_finalIKInteractionObject, true);
            m_InteractionSystem.StartInteraction(FullBodyBipedEffector.RightHand, m_finalIKInteractionObject, true);

            if (m_onStartInteractionEvent != null)
            {
                m_onStartInteractionEvent.Invoke();
            }

            MovePlayerToRightPos();
        }
        private void OnDestroy()
        {
            if (this.interactionSystem == null)
            {
                return;
            }
            InteractionSystem expr_18 = this.interactionSystem;

            expr_18.OnInteractionStart = (InteractionSystem.InteractionDelegate)Delegate.Remove(expr_18.OnInteractionStart, new InteractionSystem.InteractionDelegate(this.OnStart));
            InteractionSystem expr_3F = this.interactionSystem;

            expr_3F.OnInteractionPause = (InteractionSystem.InteractionDelegate)Delegate.Remove(expr_3F.OnInteractionPause, new InteractionSystem.InteractionDelegate(this.OnPause));
            InteractionSystem expr_66 = this.interactionSystem;

            expr_66.OnInteractionResume = (InteractionSystem.InteractionDelegate)Delegate.Remove(expr_66.OnInteractionResume, new InteractionSystem.InteractionDelegate(this.OnDrop));
        }
    private void Start()
    {
        if (isMainCharacter)
        {
            player = KickStarter.player;
        }
        else
        {
            player = GetComponent <NPC>();
        }

        interactionSystem = player.GetComponent <InteractionSystem>();
        controller        = player.GetComponent <ObjectInteractControl>();
        audioSource       = player.GetComponent <AudioSource>();
        objectBeingHeld   = false;
    }
Beispiel #20
0
            // Stop touching the walls
            private void StopTouch(InteractionSystem interactionSystem)
            {
                interactionObject.transform.parent = interactionSystem.transform;
                nextSwitchTime = Time.time + minSwitchTime / interactionSystem.speed;

                if (interactionSystem.IsPaused(effectorType))
                {
                    interactionSystem.ResumeInteraction(effectorType);
                }
                else
                {
                    speedF         = 0f;
                    targetPosition = hit.point;
                    targetRotation = Quaternion.LookRotation(-hit.normal);
                }
            }
        override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <InteractionSystem>();

            if (interactionSystem != null)
            {
                if (handsUsed == HandsUsed.Both)
                {
                    interactionSystem.isBothHands = true;
                    interactionSystem.isRightHand = false;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.Right)
                {
                    interactionSystem.isRightHand = true;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.isBothHands = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.Left)
                {
                    interactionSystem.isLeftHand  = true;
                    interactionSystem.isBothHands = false;
                    interactionSystem.isRightHand = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.None)
                {
                    interactionSystem.noHandIK    = true;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.isBothHands = false;
                    interactionSystem.isRightHand = false;
                }

                if (interactionSystem.objectBeingHeld)
                {
                    InteractionAnimation(trigger.name);
                }
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
        public override void StartInteraction(InteractionSystem interactionSystem)
        {
            if (m_isInInteraction)
            {
                return;
            }
            m_InteractionSystem = interactionSystem;
            m_isInInteraction   = true;

            m_laddderUpGateCollider.enabled = false;
            SetInteractionTargetPivotPosition();

            m_InteractionSystem.StartInteraction(FullBodyBipedEffector.LeftHand, m_finalIKInteractionObject, true);
            m_InteractionSystem.StartInteraction(FullBodyBipedEffector.RightHand, m_finalIKInteractionObject, true);

            MovePlayerToRightPosAndStartInteract();
        }
Beispiel #23
0
    public override void Open()
    {
        if (spawnedButtons.Count > 0)
        {
            for (int i = spawnedButtons.Count - 1; i >= 0; i--)
            {
                Destroy(spawnedButtons[i]);
            }
        }
        spawnedButtons.Clear();

        IInteractable[] interactions = target.GetComponents <IInteractable>();
        for (int i = 0; i < interactions.Length; i++)
        {
            if (!interactions[i].IsEnabled())
            {
                continue;
            }
            InteractionButton interactionButton = Instantiate(interactionButtonPrefab, transform);
            spawnedButtons.Add(interactionButton.gameObject);
            string interactionName = interactions[i].GetName();
            int    index           = i;
            interactionButton.button.onClick.AddListener(() =>
            {
                InteractionSystem.SendInteraction(interactions[index]);
                Close();
            });

            interactionButton.text.enabled = interactions[i].GetIcon() == null;
            interactionButton.icon.enabled = interactions[i].GetIcon();

            interactionButton.text.SetText(interactions[i].GetName());
            interactionButton.icon.sprite = interactions[i].GetIcon();

            interactionButton.info = interactions[i].GetName();
        }

        gameObject.SetActive(true);
        float duration = .5f;

        open = true;
        tweener.Kill();
        canvasGroup.alpha = 1;
        tweener           = DOTween.To(x => SetRadius(x), 0f, openRadius, duration).SetEase(Ease.OutElastic);
    }
        override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <InteractionSystem>();

            if (interactionSystem != null)
            {
                //Clear the existing values
                interactionSystem.ClearData();

                //Send the new values
                PopulateValues(interactionSystem);
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
Beispiel #25
0
    public virtual void OnInteraction(InteractionSystem system, int option = 0)
    {
        List <InteractionOption> ActiveOptions = Options.Where(a => a.Validate == null || a.Validate.Invoke()).ToList();

        if (ActiveOptions.Count >= option)
        {
            if (ActiveOptions[option].OnInteractionEvent != null)
            {
                ActiveOptions[option].OnInteractionEvent.Invoke();
            }
            if (ActiveOptions[option].OnInteraction != null)
            {
                ActiveOptions[option].OnInteraction();
            }
        }

        SetDirty();
    }
        public void PopulateValues(InteractionSystem intSystem)
        {
            trigger = animator.parameters[animatorNum];

            //Load the correct interaction object list
            intSystem.interactionList = interactionList;

            //The data that needs to be stored
            intSystem.interactionObject = interactionObject;


            if (handsUsed == HandsUsed.Both)
            {
                intSystem.isBothHands = true;
                intSystem.isRightHand = false;
                intSystem.isLeftHand  = false;
                intSystem.noHandIK    = false;
            }
            if (handsUsed == HandsUsed.Right)
            {
                intSystem.isRightHand = true;
                intSystem.isLeftHand  = false;
                intSystem.isBothHands = false;
                intSystem.noHandIK    = false;
            }
            if (handsUsed == HandsUsed.Left)
            {
                intSystem.isLeftHand  = true;
                intSystem.isBothHands = false;
                intSystem.isRightHand = false;
                intSystem.noHandIK    = false;
            }
            if (handsUsed == HandsUsed.None)
            {
                intSystem.noHandIK    = true;
                intSystem.isLeftHand  = false;
                intSystem.isBothHands = false;
                intSystem.isRightHand = false;
            }


            InteractionAnimation(trigger.name);
        }
Beispiel #27
0
            // Initiate this instance
            public void Initiate(InteractionSystem interactionSystem)
            {
                // Find the direction to the interaction objet relative to the sperecastFrom Transform
                raycastDirectionLocal = spherecastFrom.InverseTransformDirection(interactionObject.transform.position - spherecastFrom.position);

                // Find the max distance the sperecast
                raycastDistance = Vector3.Distance(spherecastFrom.position, interactionObject.transform.position);

                // Add to the interaction system delegates
                interactionSystem.OnInteractionStart  += OnInteractionStart;
                interactionSystem.OnInteractionResume += OnInteractionResume;
                interactionSystem.OnInteractionStop   += OnInteractionStop;

                hit.normal     = Vector3.forward;
                targetPosition = interactionObject.transform.position;
                targetRotation = interactionObject.transform.rotation;

                initiated = true;
            }
    public MovementManager(BjjPlayer bjjPlayer) //TODO: really we should be passing a subclass of BjjPlayer here
    {
        _player = bjjPlayer;
        _ik     = _player.GetComponentInChildren <FullBodyBipedIK>();
        _is     = _player.GetComponentInChildren <InteractionSystem>();
        _ik.Disable();

        leftHand      = new BodyPoint(SearchHierarchyForBone(_player.transform, "L Wrist").gameObject, FullBodyBipedEffector.LeftHand);
        rightHand     = new BodyPoint(SearchHierarchyForBone(_player.transform, "R Hand GP").gameObject, FullBodyBipedEffector.RightHand);
        leftFoot      = new BodyPoint(null, FullBodyBipedEffector.LeftFoot);
        rightFoot     = new BodyPoint(null, FullBodyBipedEffector.RightFoot);
        leftThigh     = new BodyPoint(null, FullBodyBipedEffector.LeftThigh);
        rightThigh    = new BodyPoint(null, FullBodyBipedEffector.RightThigh);
        leftShoulder  = new BodyPoint(null, FullBodyBipedEffector.LeftShoulder);
        rightShoulder = new BodyPoint(null, FullBodyBipedEffector.RightShoulder);
        body          = new BodyPoint(null, FullBodyBipedEffector.Body);

        BodyPoints = new List <BodyPoint> {
            leftHand, rightHand, leftFoot, rightFoot, leftThigh, rightThigh, leftShoulder, rightShoulder, body
        };
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        // ////////////////////////////////
        // 현우형이 추가해준 코드
        //if(!collision.CompareTag("Door"))
        //{
        //    return;
        //}
        // ///////////////////////////////

        //// collision에 초기화된 오브젝트를 확인
        //if (collision.CompareTag("Fire"))
        //    return;
        triggerObj = collision.gameObject;


        //Debug.Log("GetInteraction이 " + triggerObj.name + "를 참조");

        // (18.07.30) doAction() 부분에서 옮겨옴. 카메라에서 사용되기 위함
        triggerInteraction = triggerObj.GetComponent <InteractionSystem>();

        //charState = CharacterState.ONDOOR; // (18.08.06) 카메라 상태 삭제 예정
    }
Beispiel #30
0
        override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <InteractionSystem>();

            if (interactionSystem != null)
            {
                if (interactionSystem.objectBeingHeld)
                {
                    if (interactionSystem.isLeftHand)
                    {
                        interactionCharacter.GetComponent <Animator>().SetTrigger("PutAwayLeft");
                    }
                    else if (interactionSystem.isRightHand)
                    {
                        interactionCharacter.GetComponent <Animator>().SetTrigger("PutAwayRight");
                    }
                }
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
Beispiel #31
0
    //endPoint is higer than startPoint(with offset)

    void Start()
    {
        _lr = GetComponent <LineRenderer> ();

        if (!photonView.isMine)
        {
            return;
        }

        if (StartTarget.GetComponent <CombatHandler> () != null)
        {
            StartTarget.GetComponent <CombatHandler> ().RopeSlotStart = this;
        }

        if (EndTarget.GetComponent <CombatHandler> () != null)
        {
            EndTarget.GetComponent <CombatHandler> ().RopeSlotEnd = this;
        }

        //make line collider ignore two drivers
        if (StartTarget.GetComponent <Collider> () && StartTarget.GetComponent <PhotonView> ())
        {
//			Physics.IgnoreCollision (RC_Collider.GetComponent<Collider> (), StartTarget.GetComponent<Collider> (), true);
            IgnoreCollision(StartTarget.GetComponent <PhotonView> ().viewID, true);
        }

        if (EndTarget.GetComponent <Collider> () && EndTarget.GetComponent <PhotonView> ())
        {
            //			Physics.IgnoreCollision (RC_Collider.GetComponent<Collider> (), EndTarget.GetComponent<Collider> (), true);
            IgnoreCollision(EndTarget.GetComponent <PhotonView> ().viewID, true);
        }

//		_rb = Owner.GetComponent<Rigidbody> ();

        _intSys = StartTarget.GetComponent <InteractionSystem> ();
    }
Beispiel #32
0
    private void InitializeEyeX()
    {
        try
        {
            // Note: the Unity console logger can be enabled if/when needed.
            // it is disabled by default, because it leaves a dangling reference
            // the first time the game is run, and might cause Unity to crash when
            // the game is restarted.
            _system = InteractionSystem.Initialize();
            //_system = InteractionSystem.Initialize(CreateUnityConsoleLogger());

            print("EyeX initialization succeeded.");
        }
        catch (InteractionApiException ex)
        {
            print("EyeX initialization failed: " + ex.Message);
        }
    }
Beispiel #33
0
    private void ShutdownEyeX()
    {
        try
        {
            if (_context != null)
            {
                _context.Dispose();
                _context = null;
            }

            if (_system != null)
            {
                _system.Dispose();
                _system = null;
            }

            print("EyeX shutdown finished.");
        }
        catch (InteractionApiException ex)
        {
            print("EyeX shutdown failed: " + ex.Message);
        }
    }