public override bool Update()
        {
            if (null == m_DigTool)
            {
                motionMgr.EndImmediately(ActionType);
                return(true);
            }

            if (m_EndDig)
            {
                m_FixTimer.Update(Time.deltaTime);
                if (m_EndAnim || m_FixTimer.Second <= 0)
                {
                    OnEndAction();
                    return(true);
                }
            }

            if (null != crusher)
            {
                crusher.UpdateEnCost();
            }
            skillCmpt._lastestTimeOfConsumingStamina = Time.time;
            return(false);
        }
Esempio n. 2
0
 void UpdateTips()
 {
     mNoticeTimer.Update(Time.deltaTime);
     if (mNoticeTimer.Second < 0)
     {
         mNoticeTimer.Second = 1f;
         if (mShowPositionErrorTips)
         {
             GlobalShowGui_N.ShowString(UIMsgBoxInfo.CannotPut.GetString());
             mShowPositionErrorTips = false;
         }
         else
         {
             if (mShowDistanceErrorTips)
             {
                 GlobalShowGui_N.ShowString(UIMsgBoxInfo.DistanceNotMatch.GetString());
                 mShowDistanceErrorTips = false;
             }
             else if (mShowLinkErrorTips)
             {
                 GlobalShowGui_N.ShowString(UIMsgBoxInfo.ConnectError.GetString());
                 mShowLinkErrorTips = false;
             }
         }
     }
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (Timer != null)
        {
            if (_passingTime)
            {
                if (Timer.Tick >= _targetTick)
                {
                    Timer.Tick        = _targetTick;
                    _passingTime      = false;
                    _targetTick       = 0;
                    Timer.ElapseSpeed = NormalTimeSpeed;
                }
            }

            Timer.Update(Time.deltaTime);
            PlayTime.Update(Time.deltaTime);

            if (Application.isEditor)
            {
                if (Input.GetKeyDown(KeyCode.Keypad1))
                {
                    Timer.ElapseSpeed = 10000;
                }
                if (Input.GetKeyUp(KeyCode.Keypad1))
                {
                    Timer.ElapseSpeed = NormalTimeSpeed;
                }
                if (Input.GetKey(KeyCode.Keypad1))
                {
                    Timer.ElapseSpeed *= 1.01f;
                    if (Timer.ElapseSpeed > 1000000)
                    {
                        Timer.ElapseSpeed = 1000000;
                    }
                }
            }

#if DEBUG_TIMER
            if (Application.isEditor)
            {
                m_ElapseSpeed = Timer.ElapseSpeed;
                m_Tick        = Timer.Tick.ToString("#,##0");
                m_Day         = Timer.Day;
                m_Hour        = Timer.Hour;
                m_Minute      = Timer.Minute;
                m_Second      = Timer.Second;
                m_TimeInDay   = Timer.TimeInDay;
                m_HourInDay   = Timer.HourInDay;
                m_MinuteInDay = Timer.MinuteInDay;
                m_SecondInDay = Timer.SecondInDay;
                m_CycleInDay  = Timer.CycleInDay;
                m_TimeString  = Timer.FormatString("D hh:mm:ss AP");
            }
#endif
        }
    }
Esempio n. 4
0
 public override bool CheckFilter()
 {
     mTimer.Update(Time.deltaTime);
     if (mTimer.Second <= 0)
     {
         mTimer.Second = mIntervalTime;
         return(true);
     }
     return(base.CheckFilter());
 }
Esempio n. 5
0
    void FixedUpdate()
    {
        if (m_Assembly != null)
        {
            if (m_triggerTimer.Second >= m_Assembly.damageCD)
            {
                m_triggerTimer.Second = 0;
            }

            m_triggerTimer.Update(Time.deltaTime);
        }
    }
Esempio n. 6
0
 void Update()
 {
     if (GameConfig.IsMultiMode)
     {
         if (null != m_Time)
         {
             m_Time.Update(Time.deltaTime);
             if (m_Time.Second < 0 && Mathf.Abs(m_LastNetValue - enCurrent) > GameConfig.NetMinUpdateValue)
             {
                 m_Time.Second  = GameConfig.NetUpdateInterval;
                 m_LastNetValue = enCurrent;
                 //SendMsg
                 PlayerNetwork.mainPlayer.RequestJetPackEnergyReload(m_Entity.Id, m_ItemObj.instanceId, m_LastNetValue);
             }
         }
     }
 }
Esempio n. 7
0
    void Update()
    {
        if (null != m_Energy)
        {
            m_Energy.floatValue.current = m_Entity.GetAttribute(AttribType.Energy);
        }

        if (GameConfig.IsMultiMode)
        {
            if (null != m_Time)
            {
                m_Time.Update(Time.deltaTime);
                if (m_Time.Second < 0 && Mathf.Abs(m_LastNetValue - m_Entity.GetAttribute(AttribType.Energy)) > GameConfig.NetMinUpdateValue)
                {
                    m_Time.Second  = GameConfig.NetUpdateInterval;
                    m_LastNetValue = m_Entity.GetAttribute(AttribType.Energy);
                    //SendMsg
                    PlayerNetwork.mainPlayer.RequestBatteryEnergyReload(m_Entity.Id, m_ItemObj.instanceId, m_LastNetValue);
                }
            }
        }
    }
Esempio n. 8
0
    void Update()
    {
        if (null == m_Operater && null == m_SpeepEvent)
        {
            Hide();
            return;
        }

        if (mSlider.gameObject.activeSelf)
        {
            if (mTimer == null)
            {
                return;
            }

            mTimer.Update(Time.deltaTime);
            if (mTimer.Second > mGetItemTime)
            {
                mTimer.Second = mGetItemTime;
                if (mDoGet != null)
                {
                    mDoGet();
                    mSlider.gameObject.SetActive(false);
                    gameObject.SetActive(false);
                }
            }
            mSlider.sliderValue = (float)mTimer.Second / mGetItemTime;
        }


        mSleepTime.text = string.Format(PELocalization.GetString(8000251), GetCurSleepTime());

        if (mAddBtnPress)
        {
            float dT = Time.time - mOpStarTime;
            if (dT < 0.2f)
            {
                mOpDurNum = 1;
            }
            else if (dT < 1f)
            {
                mOpDurNum += 2 * Time.deltaTime;
            }
            else if (dT < 2f)
            {
                mOpDurNum += 4 * Time.deltaTime;
            }
            else if (dT < 3f)
            {
                mOpDurNum += 7 * Time.deltaTime;
            }
            else if (dT < 4f)
            {
                mOpDurNum += 11 * Time.deltaTime;
            }
            else if (dT < 5f)
            {
                mOpDurNum += 16 * Time.deltaTime;
            }
            else
            {
                mOpDurNum += 20 * Time.deltaTime;
            }

            int addNum = (int)(mOpDurNum + mCurrentNum);
            int farNum = this.m_AmmoMaxCount - this.m_AmmoCount;
            mCurrentNum = Mathf.Clamp((addNum > farNum) ? farNum : addNum, 0, this.m_AmmoMaxHave);
            mNum.text   = mCurrentNum.ToString();
        }
        else if (mSubBtnPress)
        {
            float dT = Time.time - mOpStarTime;
            if (dT < 0.5f)
            {
                mOpDurNum = -1;
            }
            else if (dT < 1f)
            {
                mOpDurNum -= 2 * Time.deltaTime;
            }
            else if (dT < 2f)
            {
                mOpDurNum -= 4 * Time.deltaTime;
            }
            else if (dT < 3f)
            {
                mOpDurNum -= 7 * Time.deltaTime;
            }
            else if (dT < 4f)
            {
                mOpDurNum -= 11 * Time.deltaTime;
            }
            else if (dT < 5f)
            {
                mOpDurNum -= 16 * Time.deltaTime;
            }
            else
            {
                mOpDurNum -= 20 * Time.deltaTime;
            }

            mCurrentNum = int.Parse(mNum.text);
            int SubNum = (int)(mOpDurNum + mCurrentNum);
            mCurrentNum = (SubNum < 0) ? 0 : SubNum;
            mNum.text   = mCurrentNum.ToString();
        }

        // 超过 30 米取消睡觉操作
        if (mSleepWnd.activeSelf)
        {
            if (null == mEntity || null == m_PeSleep ||
                Vector3.Distance(mEntity.position, m_PeSleep.transform.position) > 30)
            {
                OnCancelBtn();
            }
        }
    }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        if (!m_First)
        {
            return;
        }

//		if (GameConfig.GameMode == GameConfig.EGameMode.Singleplayer_Build)
//			m_Timer.ElapseSpeed = -1;
//		else
        //m_Timer.ElapseSpeed = Mathf.Min(-1, -GameTime.Timer.ElapseSpeed / GameTime.NormalTimeSpeed);

        m_Timer.ElapseSpeed = -1;
        m_Timer.Update(Time.deltaTime);

        m_CurCounter = (m_FinalCounter - (float)m_Timer.Second);

        if (m_Timer.Tick <= 0)
        {
            if (OnTimeUp != null)
            {
                OnTimeUp();
            }
            if (runCount <= 1)
            {
                DestroyImmediate(this);
            }
            else
            {
                runCount--;
            }
        }
        else
        {
            if (OnTimeTick != null)
            {
                OnTimeTick(Mathf.Abs(m_Timer.ElapseSpeed * Time.deltaTime));
            }
        }
//		if (m_First )
//		{
//			m_StartTime = GameTime.Timer.Second;
//			m_First = false;
//			return;
//		}
//
//
//		if (CurCounter < FinalCounter)
//		{
//			float delta =  (float)(GameTime.Timer.Second - m_StartTime) * 0.083f;
//
//			CurCounter += delta;
//			if (CurCounter > FinalCounter)
//				delta -= (FinalCounter - CurCounter);
//			if (OnTimeTick != null)
//				OnTimeTick(delta);
//		}
//		else
//		{
//			if (OnTimeUp != null && m_TimeUp)
//			{
//				m_TimeUp = false;
//				OnTimeUp();
//			}
//			DestroyImmediate(this);
//		}
//
//		m_StartTime = GameTime.Timer.Second;
    }
Esempio n. 10
0
 protected virtual void FixAnimError()
 {
     if (null == handChangeEquipment)
     {
         return;
     }
     if (m_EndAction)
     {
         if (!m_PutOffAnimEnd)
         {
             m_FixErrorTimer.Update(Time.deltaTime);
             if (m_FixErrorTimer.Second <= 0)
             {
                 m_PutOffAnimEnd = true;
                 ChangeHoldState(false);
                 motionMgr.SetMaskState(m_ActionMask, false);
                 entity.motionEquipment.SetWeapon(null);
                 if (null != ikCmpt)
                 {
                     ikCmpt.SetSpineEffectDeactiveState(this.GetType(), false);
                 }
             }
         }
         else
         {
             if (null != handChangeEquipment.transform.parent && handChangeEquipment.transform.parent.name != handChangeEquipment.m_HandChangeAttr.m_PutOffBone)
             {
                 viewCmpt.Reattach(handChangeEquipment.gameObject, handChangeEquipment.m_HandChangeAttr.m_PutOffBone);
             }
         }
     }
     else
     {
         if (!m_PutOnAnimEnd)
         {
             m_FixErrorTimer.Update(Time.deltaTime);
             if (m_FixErrorTimer.Second <= 0)
             {
                 m_PutOnAnimEnd = true;
                 ChangeHoldState(true);
                 motionMgr.SetMaskState(m_ActionMask, true);
                 entity.motionEquipment.SetWeapon(handChangeEquipment);
                 if (null != handChangeEquipment)
                 {
                     motionMgr.Entity.SendMsg(EMsg.Camera_ChangeMode, handChangeEquipment.m_HandChangeAttr.m_CamMode);
                 }
                 if (null != ikCmpt)
                 {
                     ikCmpt.SetSpineEffectDeactiveState(this.GetType(), true);
                 }
             }
         }
         else
         {
             if (null != handChangeEquipment.transform.parent && handChangeEquipment.transform.parent.name != handChangeEquipment.m_HandChangeAttr.m_PutOnBone)
             {
                 viewCmpt.Reattach(handChangeEquipment.gameObject, handChangeEquipment.m_HandChangeAttr.m_PutOnBone);
             }
         }
     }
 }