void EventShower_SlideStateChanged(SlideState obj)
 {
     if (obj == SlideState.Idle)
     {
         foreground.state = SlideState.Entering;
     }
 }
 internal void Update(GameTime gameTime)
 {
     if (_slideState == SlideState.TransitionOn)
     {
         _pos += (_transitionDir * 20);
         if (_pos == 0)
         {
             _slideState = SlideState.Active;
         }
         OnActivate?.Invoke(this, null);
     }
     else if (_slideState == SlideState.TransitionOff)
     {
         _pos += (_transitionDir * 20);
         if (Math.Abs(_pos) == BOUNDARY)
         {
             _slideState = SlideState.Inactive;
         }
         OnDeactivate?.Invoke(this, null);
     }
     else if (_slideState == SlideState.Active)
     {
         foreach (var r in _renderers)
         {
             r.Update(gameTime);
         }
     }
 }
    public void AttachExperience(Experience e)
    {
        this.experience = e;
        this.state      = SlideState.AR;

        GameObject target = experience.GetTarget();
    }
Example #4
0
        void Update()
        {
            switch (m_SlideState)
            {
            case SlideState.MovingIn:
                m_SlideTimer += Time.deltaTime;
                if (m_SlideTimer >= m_SlideDuration)
                {
                    m_SlideState = SlideState.Showing;
                    m_SlideTimer = m_SlideDuration;
                }
                m_Sidebar.position = new Vector2(
                    2 * m_SidebarPosX * m_SlideTimer / m_SlideDuration - m_SidebarPosX, m_Sidebar.position.y);
                break;

            case SlideState.MovingOut:
                m_SlideTimer -= Time.deltaTime;
                if (m_SlideTimer <= 0)
                {
                    m_SlideState = SlideState.Hidden;
                    m_SlideTimer = 0;
                }
                m_Sidebar.position = new Vector2(
                    2 * m_SidebarPosX * m_SlideTimer / m_SlideDuration - m_SidebarPosX, m_Sidebar.position.y);
                break;
            }
        }
Example #5
0
    public PlayerState(IEventManager playerEvent)
    {
        #region Player State Initialization
        _StateIdle              = new IdleState(this);
        _StateWalk              = new WalkState(this);
        _StateSprint            = new SprintState(this);
        _StateFall              = new FallState(this);
        _StateCrouch            = new CrouchState(this);
        _StateJump              = new JumpState(this);
        _StateCrouchWalk        = new CrouchWalkState(this);
        _StateSlide             = new SlideState(this);
        _StateCrouchJump        = new CrouchJumpState(this);
        _StateCrouchFall        = new CrouchFallState(this);
        _StateAirMoveCrouchFall = new AirMoveCrouchFallState(this);
        _StateAirMoveCrouchJump = new AirMoveCrouchJumpState(this);
        _StateAirMoveFall       = new AirMoveFallState(this);
        _StateAirMoveJump       = new AirMoveJumpState(this);
        #endregion

        _ActiveProxies      = new HashSet <IDynamicProxy>();
        _EventPlayer        = playerEvent;
        _CurrentPlayerState = _StateIdle;

        #region State Proxy Initialization
        _MediatorToggleProxy             = new ToggleProxyMediator();
        _ProxySprint                     = new SprintProxy(this, _MediatorToggleProxy);
        _ProxyCrouch                     = new CrouchProxy(this, _MediatorToggleProxy);
        _MediatorToggleProxy.ProxyCrouch = _ProxyCrouch;
        _MediatorToggleProxy.ProxySprint = _ProxySprint;

        _ProxyWalk = new WalkProxy(this, _MediatorToggleProxy);
        _ProxyFall = new FallProxy(this);
        _ProxyJump = new JumpProxy(this, _MediatorToggleProxy);
        #endregion
    }
 private void checkForArrival()
 {
     if (Vector3.Distance(transform.position, destination) < .1f)
     {
         state = SlideState.Nothing;
         transform.position = destination;
     }
 }
 private void OnMouseExit()
 {
     if (!selected)
     {
         state = SlideState.In;
         setDestination();
     }
 }
 private void OnMouseOver()
 {
     if (!selected)
     {
         state = SlideState.Out;
         setDestination();
     }
 }
Example #9
0
 public override void ManipulateLeft()
 {
     if(m_slideState == SlideState.Forward){
         m_partialReload = false;
         m_slideState = SlideState.Back;
         m_chamber = m_magazine[0];
         RemoveTopRound();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     currentSlideState = SlideState.clean;
     currentGramState  = GramState.clean;
     hasBeenHeatFixed  = false;
     isCurrentlySoaked = false;
     currentLiquid     = SoakedLiquidType.None;
     thisSlideMaterial = GetComponent <Renderer>().material;
 }
Example #11
0
 void Awake()
 {
     m_Instance                     = this;
     m_SidebarPosX                  = m_Sidebar.position.x;
     m_SlideState                   = SlideState.Hidden;
     m_Sidebar.position             = new Vector2(-m_SidebarPosX, m_Sidebar.position.y);
     OAuth2Identity.ProfileUpdated += OnProfileUpdated;
     RefreshObjects();
 }
Example #12
0
 void Start()
 {
     comicFrameUI.SetActive(false);
     currPage                  = 0;
     slideState                = SlideState.STATIONARY;
     playButt.interactable     = false;
     prevPageButtImage.enabled = false;
     nextPageButtImage.enabled = false;
 }
Example #13
0
 protected override void OnManipulationStarted(ManipulationStartedRoutedEventArgs e)
 {
     if (e.PointerDeviceType == PointerDeviceType.Touch && !e.Handled && _selected != null)
     {
         // 不可在此处重置RenderTransform,uno中当内部包含ScollViewer且内嵌面板有背景色时会造成delta莫名变大!很难发现问题原因
         e.Handled    = true;
         _innerScroll = this.FindChildByType <ScrollViewer>();
         _state       = SlideState.Start;
     }
 }
    private void GramStateChange(Collider innoculation)
    {
        currentGramState = innoculation.gameObject.GetComponent <InnoculatingLoopBehaviour>().currentLoopState;

        if (currentGramState != GramState.clean)
        {
            thisSlideMaterial.color = Color.yellow;
            currentSlideState       = SlideState.smeared;
        }
    }
Example #15
0
    void CollapseImmediate()
    {
        state = SlideState.Collapsed;

        tmpV2         = _rt.offsetMin;
        tmpV2.x       = -extensionSize;
        _rt.offsetMin = tmpV2;

        tmpV2         = _rt.offsetMax;
        tmpV2.x       = 0;
        _rt.offsetMax = tmpV2;
    }
Example #16
0
 public SavedState(Parcel parcel)
     : base(parcel)
 {
     try
     {
         State = (SlideState)parcel.ReadInt();
     }
     catch
     {
         State = SlideState.Collapsed;
     }
 }
Example #17
0
    public void SlideComicLeftAndOut(float speed = comicSlideSpeedTypical)
    {
        // Disable Comic UI Objects
        playButtImage.sprite  = playButtGray;
        playButt.interactable = false;
        currPage = -1;

        // Start slide
        lerp_timer      = 0;
        comicSlideSpeed = speed;
        slideState      = SlideState.SLIDE_LEFT_OUT;
    }
Example #18
0
 protected override void OnRestoreInstanceState(IParcelable state)
 {
     try
     {
         var savedState = (SavedState)state;
         base.OnRestoreInstanceState(savedState.SuperState);
         _slideState = savedState.State;
     }
     catch
     {
         base.OnRestoreInstanceState(state);
     }
 }
Example #19
0
    /**
     * Called from the "EXIT" button on the comic UI itself.
     * Sets the comic's slideState to shift it off the screen. The Update()
     * method will handle the actual shifting based on the slideState.
     * This method also shifts the camera back to alpaca, reverting it to its
     * normal state.
     */
    public void HideComicAndShiftCam(float speed = comicSlideSpeedTypical)
    {
        // Disable Comic UI Objects
        playButtImage.sprite  = playButtGray;
        playButt.interactable = false;
        currPage = -1;

        // Start slide
        lerp_timer      = 0;
        comicSlideSpeed = speed;
        slideState      = SlideState.SLIDE_RIGHT;
        cameraController.shiftCamToAlpaca();
    }
Example #20
0
        void SetLockX(ManipulationDeltaRoutedEventArgs e)
        {
            // 水平滑动距离是垂直的n倍
            if (_state == SlideState.Start &&
                Math.Abs(e.Delta.Translation.X) > Math.Abs(e.Delta.Translation.Y) * 3)
            {
                _state = SlideState.LockX;
            }

            if (_state == SlideState.LockX)
            {
                ((TranslateTransform)((UIElement)_selected.DataContext).RenderTransform).X += e.Delta.Translation.X;
            }
        }
    public Slide(Slide s)
    {
        this.text = s.text;
        this.gui = s.gui;
        this.parent = s.parent;
        s.experience.SetOwner (this);
        this.experience = (Experience) Activator.CreateInstance(s.experience.GetType(), s.experience);
        this.question = s.question;
        this.state = s.state;

        if (this.state == SlideState.DONE) {
            this.state = SlideState.AR;
        }
    }
    /// <summary>
    /// Constantly Checks the Microscope Drop Zone for a snapped object.
    /// </summary>///

    private void CheckMicroScopeSnapDropZone()
    {
        if (snapDropZoneToCheck.isSnapped)
        {
            SetSlideLoaded(true);
            RetrieveSlideInfo();
        }
        else
        {
            SetSlideLoaded(false);
            loadedSlideState = SlideState.clean;
            ResetMicroscopeState();
        }
    }
 public void setSelected(bool value)
 {
     selected = value;
     if (transform.position != outPosition && selected)
     {
         state = SlideState.Out;
         setDestination();
     }
     else if (transform.position != inPosition && !selected)
     {
         state = SlideState.In;
         setDestination();
     }
 }
    public Slide(Slide s)
    {
        this.text   = s.text;
        this.gui    = s.gui;
        this.parent = s.parent;
        s.experience.SetOwner(this);
        this.experience = (Experience)Activator.CreateInstance(s.experience.GetType(), s.experience);
        this.question   = s.question;
        this.state      = s.state;

        if (this.state == SlideState.DONE)
        {
            this.state = SlideState.AR;
        }
    }
Example #25
0
    /**
     * Displays comic frame UI and sets slideState to SLIDE_LEFT which Update()
     * will use to slide it in.
     * Also shifts the camera to the comic's position.
     */
    public void DisplayComicAndShiftCam(float speed = comicSlideSpeedTypical)
    {
        // Set UI Elements
        comicFrameImage.sprite = comic.panels[0];
        comicFrameUI.SetActive(true);
        nextPageButtImage.enabled = (comic.getSize() > 1);
        prevPageButtImage.enabled = false;
        currPage = 0;

        // Start slide
        lerp_timer      = 0;
        comicSlideSpeed = speed;
        slideState      = SlideState.SLIDE_LEFT_IN;
        cameraController.shiftCamToComic();
    }
 private void OnDisable()
 {
     IdleState.Dispose();
     MoveState.Dispose();
     JumpState.Dispose();
     InAirState.Dispose();
     LandState.Dispose();
     WallSlideState.Dispose();
     LedgeClimbState.Dispose();
     CrouchIdleState.Dispose();
     CrouchMoveState.Dispose();
     SwordAttackState.Dispose();
     HandAttackState.Dispose();
     AirAttackState.Dispose();
     SlideState.Dispose();
 }
Example #27
0
 protected override void OnManipulationCompleted(ManipulationCompletedRoutedEventArgs e)
 {
     if (e.PointerDeviceType == PointerDeviceType.Touch && _state == SlideState.LockX)
     {
         e.Handled = true;
         var    con    = (FrameworkElement)_selected.DataContext;
         double deltaX = ((TranslateTransform)((UIElement)_selected.DataContext).RenderTransform).X;
         if (Math.Abs(deltaX) > con.ActualWidth / 2)
         {
             SwitchPage();
         }
         else if (deltaX != 0)
         {
             CancelPaging();
         }
     }
     _state = SlideState.None;
 }
Example #28
0
    // Update is called once per frame
    void Update()
    {
        switch (state)
        {
        case SlideState.Paused:
            transform.position = startPosition;
            break;

        case SlideState.Entering:
        {
            timePassed += Time.deltaTime;
            transform.localPosition = Vector3.Lerp(startPosition, idlePosition, timePassed / timeToTake);

            if (timePassed >= timeToTake)
            {
                state = SlideState.Idle;
            }
            break;
        }

        case SlideState.Idle:
        {
            //transform.localPosition = idlePosition;
            timePassed = 0.0f;
            break;
        }

        case SlideState.Exiting:
        {
            timePassed += Time.deltaTime;
            transform.localPosition = Vector3.Lerp(idlePosition, endPosition, timePassed / timeToTake);
            if (timePassed >= timeToTake)
            {
                state = SlideState.Done;
            }
            break;
        }

        case SlideState.Done:
        {
            break;
        }
        }
    }
Example #29
0
    IEnumerator ExtendSlide()
    {
        state = SlideState.Extending;
        while (_rt.offsetMin.x < 0)
        {
            tmpV2         = _rt.offsetMin;
            tmpV2.x      += (Time.deltaTime * SlideSpeed);
            tmpV2.x       = Mathf.Clamp(tmpV2.x, -extensionSize, 0);
            _rt.offsetMin = tmpV2;

            tmpV2         = _rt.offsetMax;
            tmpV2.x       = extensionSize + _rt.offsetMin.x;
            _rt.offsetMax = tmpV2;

            yield return(null);
        }

        state = SlideState.Extended;
    }
Example #30
0
    IEnumerator CollapseSlide()
    {
        state = SlideState.Collapsing;
        while (_rt.offsetMin.x > -extensionSize)
        {
            tmpV2         = _rt.offsetMin;
            tmpV2.x      -= (Time.deltaTime * SlideSpeed);
            tmpV2.x       = Mathf.Clamp(tmpV2.x, -extensionSize, 0);
            _rt.offsetMin = tmpV2;

            tmpV2         = _rt.offsetMax;
            tmpV2.x       = extensionSize + _rt.offsetMin.x;
            _rt.offsetMax = tmpV2;

            yield return(null);
        }

        state = SlideState.Collapsed;
    }
Example #31
0
    private float lerp_timer; // Timer used for lerp-ing the comic into desired position
    void Update()
    {
        // resolve sliding of the comic frame UI
        switch (slideState)
        {
        case SlideState.SLIDE_LEFT_IN:
            lerp_timer += comicSlideSpeed * Time.deltaTime;
            comicFrameUITransform.anchoredPosition = Vector2.Lerp(comicFrameUITransform.anchoredPosition, comicDisplayedPos, lerp_timer);
            if (Mathf.Abs(comicFrameUITransform.anchoredPosition.x - comicDisplayedPos.x) <= 0.05)      // change state if the comic is done sliding
            {
                comicFrameUITransform.anchoredPosition = comicDisplayedPos;
                slideState = SlideState.STATIONARY;
            }
            break;

        case SlideState.SLIDE_LEFT_OUT:
            comicFrameUITransform.anchoredPosition = Vector2.Lerp(comicFrameUITransform.anchoredPosition, comicShowMinigamePos, lerp_timer);
            lerp_timer += comicSlideSpeed * Time.deltaTime;
            if (Mathf.Abs(comicFrameUITransform.anchoredPosition.x - comicShowMinigamePos.x) <= 0.05)      // change state if the comic is done sliding
            {
                comicFrameUITransform.anchoredPosition = comicShowMinigamePos;
                slideState = SlideState.STATIONARY;
            }
            break;

        case SlideState.SLIDE_RIGHT:
            lerp_timer += comicSlideSpeed * Time.deltaTime;
            comicFrameUITransform.anchoredPosition = Vector2.Lerp(comicFrameUITransform.anchoredPosition, comicHiddenPos, lerp_timer);
            if (Mathf.Abs(comicFrameUITransform.anchoredPosition.x - comicHiddenPos.x) <= 0.05)      // change state and hide comic if the comic is done sliding
            {
                comicFrameUITransform.anchoredPosition = comicHiddenPos;
                slideState = SlideState.STATIONARY;
                comicFrameUI.SetActive(false);
                currPage = 0;
            }
            break;

        case SlideState.STATIONARY:
        default:
            break;
        }
    }
Example #32
0
        public void Show(bool show)
        {
            switch (m_SlideState)
            {
            case SlideState.Hidden:
            case SlideState.MovingOut:
                if (show)
                {
                    m_SlideState = SlideState.MovingIn;
                }
                break;

            case SlideState.Showing:
            case SlideState.MovingIn:
                if (!show)
                {
                    m_SlideState = SlideState.MovingOut;
                }
                break;
            }
        }
Example #33
0
 void OnEnable()
 {
     ui.gameObject.SetActive (true);
     m_slideState = SlideState.Forward;
     m_magazine = new BulletState[4];
     for(int i = 0; i < m_magazine.Length; i++){
         m_magazine[i] = BulletState.Live;
     }
     m_chamber = BulletState.Live;
     m_partialReload = false;
     Update();
 }
    public void AttachExperience(Experience e)
    {
        this.experience = e;
        this.state = SlideState.AR;

        GameObject target = experience.GetTarget ();
    }
 public void AttachQuestion(Question q)
 {
     this.question = q;
     this.state = SlideState.QUESTION;
 }
    public Slide(string text)
    {
        state = SlideState.TEXT;
        this.text = text;
        GUIFactory factory = new GUIFactory();

        // Go Back Button
        GUIButton backButton = new GUIButton();

        backButton.SetText("Go Back");
        backButton.SetBox(new Box()
            .SetMarginTop("auto")
            .SetMarginRight("auto")
            .SetMarginLeft(0.01f)
            .SetMarginBottom(0.01f)
            .SetWidth(Screen.width * 0.2 + "px")
            .SetHeight (0.1f));

        backButton.OnClick(FlowControl.PreviousSlide);

        // Go Forward Button
        GUIButton nextButton = new GUIButton();

        nextButton.SetText("Continue");
        nextButton.SetBox(new Box()
            .SetMarginTop("auto")
            .SetMarginLeft("auto")
            .SetMarginRight(0.01f)
            .SetMarginBottom(0.01f)
            .SetWidth(Screen.width * 0.2 + "px")
            .SetHeight (0.1f));

        nextButton.OnClick(FlowControl.NextSlide);

        GUIComponent c = factory
            .CreateLabel (text)
                .SetBox ((new Box ())
                    .SetMarginTop (0.1f)
                    .SetMarginRight (0.1f)
                    .SetMarginBottom (0.1f)
                    .SetMarginLeft (0.1f));

        GUILabel l = (GUILabel) c;

        l.SetStyle(GUIStyles.GetInstance().DEFAULT_SLIDE_STYLE);

        l.Append (nextButton);
        l.Append (backButton);

        gui = factory.Build();

        questionBoxes = new Box[4];

        questionBoxes [0] = new Box ();
        questionBoxes [0]
                .SetMarginTop (0.55f)
                .SetMarginRight (0.51f)
                .SetMarginBottom ("auto")
                .SetMarginLeft (0.01f)
                .SetHeight (0.1f);

        questionBoxes [1] = new Box ();
        questionBoxes [1]
                .SetMarginTop (0.55f)
                .SetMarginRight (0.01f)
                .SetMarginBottom ("auto")
                .SetMarginLeft (0.51f)
                .SetHeight (0.1f);

        questionBoxes [2] = new Box ();
        questionBoxes [2]
                .SetMarginTop (0.7f)
                .SetMarginRight (0.51f)
                .SetMarginBottom ("auto")
                .SetMarginLeft (0.01f)
                .SetHeight (0.1f);

        questionBoxes [3] = new Box ();
        questionBoxes [3]
                .SetMarginTop (0.7f)
                .SetMarginRight (0.01f)
                .SetMarginBottom ("auto")
                .SetMarginLeft (0.51f)
                .SetHeight (0.1f);
    }
 public SavedState(Parcel parcel)
     : base(parcel)
 {
     try
     {
         State = (SlideState) parcel.ReadInt();
     }
     catch
     {
         State = SlideState.Collapsed;
     }
 }
 public SavedState(IParcelable superState, SlideState item)
     : base(superState)
 {
     State = item;
 }
 protected override void OnRestoreInstanceState(IParcelable state)
 {
     try
     {
         var savedState = (SavedState) state;
         base.OnRestoreInstanceState(savedState.SuperState);
         _slideState = savedState.State;
     }
     catch
     {
         base.OnRestoreInstanceState(state);    
     }
 }
Example #40
0
 public override void ManipulateRight()
 {
     if(m_partialReload){
         m_partialReload = false;
         //m_ammoReserve--;
         AddLiveRound();
     }
     if(m_slideState == SlideState.Back){
         m_slideState = SlideState.Forward;
     }
 }
 /**
  * Override whatever the slide is doing and let it know that we are done with it!
  */
 public void Done()
 {
     // We've been given word that the slide is done!
     this.state = SlideState.DONE;
 }