示例#1
0
 private void OnDisable()
 {
     if (m_iState == Types.EFlickFrameState._REVERT)
     {
         TimerManager.ClearTimerHandler(m_iTimerHandle, FlickAnim);
     }
     m_iState = Types.EFlickFrameState._FLICK;
 }
示例#2
0
    public void Awake()
    {
        m_gcRenderer = GetComponent <SpriteRenderer>();
        GAssert.Assert(null != m_gcRenderer, "No Sprite Renderer present on this GameObject: " + gameObject.name);
        GAssert.Assert(null != m_gcFrame1, "Component missing animation frames!");
        GAssert.Assert(null != m_gcFrame2, "Component missing animation frames!");

        m_iState = Types.EFlickFrameState._FLICK;
    }
示例#3
0
    // Class shouldn't be active until the object it's attached to is
    // Use the same Enter/Exit pattern to ensure any timings we need will match.
    //
    public void OnRoomEnter()
    {
        m_gcRenderer = GetComponent <SpriteRenderer>();
        GAssert.Assert(null != m_gcRenderer, "No Sprite Renderer present on this GameObject: " + gameObject.name);
        GAssert.Assert(null != m_gcFrame1, "Component missing animation frames!");
        GAssert.Assert(null != m_gcFrame2, "Component missing animation frames!");

        m_bIsAnimating = false;
        m_iState       = Types.EFlickFrameState._FLICK;
        SetCanAnimate(true, m_fInitialDelay);
    }
示例#4
0
    // Alternate between two frames
    // There's an obvious assumption here that the timer will expire before
    // the controlling component triggers this again...
    //
    public void FlickAnim()
    {
        switch (m_iState)
        {
        case Types.EFlickFrameState._FLICK:
        {
            m_gcRenderer.sprite = m_gcFrame2;
            m_iTimerHandle      = TimerManager.AddTimer(m_fFlickDuration, FlickAnim);
            m_iState            = Types.EFlickFrameState._REVERT;
        }
        break;

        case Types.EFlickFrameState._REVERT:
        {
            m_gcRenderer.sprite = m_gcFrame1;
            m_iState            = Types.EFlickFrameState._FLICK;
        }
        break;
        }
    }
示例#5
0
    // Alternate between two frames
    //
    protected void FlickAnim()
    {
        if (!m_bIsAnimating)
        {
            return;
        }

        switch (m_iState)
        {
        case Types.EFlickFrameState._FLICK: {
            m_gcRenderer.sprite = m_gcFrame2;
            m_iTimerHandle      = TimerManager.AddTimer(m_fFlickDuration, FlickAnim);
            m_iState            = Types.EFlickFrameState._REVERT;
        } break;

        case Types.EFlickFrameState._REVERT: {
            m_gcRenderer.sprite = m_gcFrame1;
            m_iTimerHandle      = TimerManager.AddTimer(m_fFlickFrameDelay - m_fFlickDuration, FlickAnim);
            m_iState            = Types.EFlickFrameState._FLICK;
        } break;
        }
    }
示例#6
0
 private void OnDisable()
 {
     m_bIsAnimating = false;
     m_iState       = Types.EFlickFrameState._FLICK;
     SetCanAnimate(false);
 }