Ejemplo n.º 1
0
        /// <summary>
        /// Is current time within the defined time frame
        /// </summary>
        /// <returns><c>true</c>, if current time is within absolute defined time, <c>false</c> otherwise.</returns>
        private bool IsWithinTimeFrame()
        {
            if (ActivateOnDependencyMap.AreDependenciesSatisfied)
            {
                // if time is beyond the specified wait time
                if (delayed && Time.time >= startTime + delayDuration || !delayed)
                {
                    // if it never expires OR expires and below ending time frame
                    if (!expires || (expires && Time.time < startTime + delayDuration + activeDuration))
                    {
                        // notify manager
                        SetTriggerState(Gaze_TriggerState.ACTIVE);
                        canBeTriggered = true;

                        // trigger if auto-trigger is set to START
                        if (GetAutoTriggerMode().Equals(Gaze_AutoTriggerMode.START))
                        {
                            TriggerCount++;
                            canBeTriggered = false;
                            Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, true, false, TriggerCount, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));

                            // check if reload needed
                            if (reload)
                            {
                                ScheduleAutoReload();
                            }
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        public void Validate()
        {
            ++TriggerCount;

            // notify manager
            Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, true, false, TriggerCount, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));
        }
Ejemplo n.º 3
0
        private IEnumerator NotifyAtStart()
        {
            yield return(new WaitForEndOfFrame());

            if (proximityFlag)
            {
                Gaze_EventManager.FireProximityEvent(new Gaze_ProximityEventArgs(IOScript, otherGameObject.GetComponentInParent <Gaze_InteractiveObject>(), true));
            }
        }
Ejemplo n.º 4
0
        private void SetTriggerState(Gaze_TriggerState state, bool forceNotify = false)
        {
            if (forceNotify || !GetTriggerState().Equals(state))
            {
                // update trigger status index
                triggerStateIndex = (int)state;

                // notify manager
                Gaze_EventManager.FireTriggerStateEvent(new Gaze_TriggerStateEventArgs(gameObject, state));
            }
        }
Ejemplo n.º 5
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.GetComponent <Gaze_Collision> () != null &&
         collision.gameObject.GetComponent <Gaze_Collision> ().detectCollision)
     {
         gaze_CollisionEventArgs.Sender         = this.gameObject;
         gaze_CollisionEventArgs.CollisionInfo  = collision;
         gaze_CollisionEventArgs.CollisionState = 1;
         Gaze_EventManager.FireCollisionEvent(gaze_CollisionEventArgs);
         //Gaze_EventManager.FireCollisionEvent (new Gaze_CollisionEventArgs (this.gameObject, collision, 1));
     }
 }
 public virtual void OnCollisionExit(Collision collision)
 {
     if (collision.gameObject.GetComponent <Gaze_AbstractCollision> () != null &&
         collision.gameObject.GetComponent <Gaze_AbstractCollision> ().detectCollision)
     {
         gaze_CollisionEventArgs.Sender         = this.gameObject;
         gaze_CollisionEventArgs.CollisionInfo  = collision;
         gaze_CollisionEventArgs.CollisionState = 3;
         Gaze_EventManager.FireCollisionEvent(gaze_CollisionEventArgs);
         //Gaze_EventManager.FireCollisionEvent (new Gaze_CollisionEventArgs (this.gameObject, collision, 3));
         Gaze_CollisionExit();
     }
 }
Ejemplo n.º 7
0
 void OnTriggerExit(Collider other)
 {
     if (other.gameObject.GetComponent <Gaze_Proximity>() != null)
     {
         if (debug)
         {
             Debug.Log("Gaze_Proximity (" + transform.parent.name + ") OnTriggerExit with " + other.GetComponentInParent <Gaze_InteractiveObject>().name);
         }
         proximityFlag   = false;
         otherGameObject = other.gameObject;
         Gaze_EventManager.FireProximityEvent(new Gaze_ProximityEventArgs(IOScript, otherGameObject.GetComponentInParent <Gaze_InteractiveObject>(), false));
     }
 }
Ejemplo n.º 8
0
        private void HandleReload()
        {
            if (reload)
            {
                // reload if necessary
                if (Time.time > nextReloadTime && reloadScheduled)
                {
                    Reload();

                    // notify manager
                    Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, false, true, reloadCount, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));
                }
            }
        }
Ejemplo n.º 9
0
 private void onGazeEvent(Gaze_GazeEventArgs e)
 {
     // if sender is the gazable collider GameObject
     if (e.Sender != null && (GameObject)e.Sender == gazable.gazeColliderIO.gameObject)
     {
         // if zoom is enabled
         if (zoom)
         {
             // if we are in a zoom status
             if (zoomOnTriggerState[gazable.triggerStateIndex])
             {
                 // notify manager
                 Gaze_EventManager.FireZoomEvent(new Gaze_ZoomEventArgs(gameObject, gazable.gazeColliderIO.GetComponentInChildren <Gaze_Gaze>().GetComponent <Collider>(), zoomFovFactor, zoomSpeedFactor, (Gaze_DezoomMode)dezoomModeIndex, dezoomSpeedFactor, zoomCurve));
             }
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Is Current time after the time frame.
        /// </summary>
        /// <returns><c>true</c>, if current time is after defined time frame, <c>false</c> otherwise.</returns>
        private bool IsAfterTimeFrame()
        {
            // if it expires
            if (expires)
            {
                // set delay duration
                delayDuration = delayed ? delayDuration : 0;

                // check if we're over the time limit
                if (Time.time >= startTime + delayDuration + activeDuration)
                {
                    // trigger if auto-trigger is set to END
                    // FIX GAZE-193 GazeSDK_v0.5.6 : and if canBeTriggered
                    if (GetAutoTriggerMode().Equals(Gaze_AutoTriggerMode.END) && canBeTriggered)
                    {
                        TriggerCount++;
                        Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, true, false, TriggerCount, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));
                    }

                    canBeTriggered = false;

                    // notify manager
                    SetTriggerState(Gaze_TriggerState.AFTER);

                    return(true);
                }
            }

            // if deactivated by dependencies
            if (!ActivateOnDependencyMap.AreDependenciesSatisfied)
            {
                canBeTriggered = false;

                // notify manager
                SetTriggerState(Gaze_TriggerState.AFTER);

                return(true);
            }
            return(false);
        }
Ejemplo n.º 11
0
        void Start()
        {
            SetDelayRandom();
            SetExpireRandom();
            focusInProgress = false;
            focusComplete   = focusDuration <= 0 ? true : false;
            ActivateOnDependencyMap.AreDependenciesSatisfied = dependent ? false : true;
            startTime   = Time.time;
            reloadCount = 0;

            // notify we're before the activity window time
            SetTriggerState(Gaze_TriggerState.BEFORE, true);

            Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, false, false, -1, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));

            // check loss speed is valid if used
            FocusLossSpeed = (GetFocusLossMode() == Gaze_FocusLossMode.FADE && FocusLossSpeed > 0) ? FocusLossSpeed : 1f;

            CheckReloadParams();

            collidingProximities = new List <GameObject>();
        }
Ejemplo n.º 12
0
        private void UpdateFocus()
        {
            // if focus is not complete
            if (!focusComplete || focusDuration <= 0f)
            {
                // set the flag
                focusInProgress = true;

                // update focus time
                focusTotalTime += Time.deltaTime;

                if (m_ProgressIndicator != null)
                {
                    m_ProgressIndicator.Show();
                    m_ProgressIndicator.UpdateProgress(focusTotalTime / focusDuration);
                }

                // set focused flag if focus time overpassed
                if (focusTotalTime >= focusDuration)
                {
                    focusComplete   = true;
                    focusInProgress = false;
                    canBeTriggered  = false;
                    TriggerCount++;

                    // notify manager
                    Gaze_EventManager.FireTriggerEvent(new Gaze_TriggerEventArgs(gameObject, Time.time, true, false, TriggerCount, GetAutoTriggerMode(), GetReloadMode(), reloadMaxRepetitions));
                    //Debug.Log(name + " Is triggered!!!");

                    // check if reload needed
                    if (reload)
                    {
                        ScheduleAutoReload();
                    }
                    return;
                }
            }
        }
 public virtual void ValidateCustomCondition(bool _conditionValidated)
 {
     IsValid = _conditionValidated;
     Gaze_EventManager.FireCustomConditionEvent(new Gaze_CustomConditionEventArgs(this.GetInstanceID(), _conditionValidated));
 }
 /// <summary>
 /// Notify to everyone that this IO has been destroyed
 /// </summary>
 private void OnDestroy()
 {
     Gaze_EventManager.FireOnIODestroyed(new Gaze_IODestroyEventArgs(this, this));
 }