void UpdateMoveEvent(float deltaTime)
    {
        // move event to avoid crash
        if (moveOprEvent != null)
        {
            moveOprEvent.OnUpdate(deltaTime);
            if (moveOprEvent.IsFinish())
            {
                moveOprEvent = null;
            }
        }

        if (gasMoveEvent != null)
        {
            gasMoveEvent.OnUpdate(deltaTime);
            if (gasMoveEvent.IsFinish())
            {
                gasMoveEvent = null;
            }
        }

        if (skillMoveEvent != null)
        {
            skillMoveEvent.OnUpdate(deltaTime);
            if (skillMoveEvent.IsFinish())
            {
                skillMoveEvent = null;
            }
        }
    }
Exemplo n.º 2
0
 public override void OnUpdate(float deltaTime)
 {
     if (jumpOprEvent != null)
     {
         jumpOprEvent.OnUpdate(deltaTime);
         if (jumpOprEvent.IsFinish())
         {
             jumpOprEvent = null;
         }
     }
 }
Exemplo n.º 3
0
    public override void OnUpdate(float deltaTime)
    {
        if (mLockMoveTimer > 0)
        {
            mLockMoveTimer = mLockMoveTimer - Time.deltaTime;
            if (mLockMoveTimer <= 0)
            {
                mLockMoveTimer = 0;
            }
        }

        if (randomSkillSprEvent != null)
        {
            randomSkillSprEvent.OnUpdate(deltaTime);
            if (randomSkillSprEvent.IsFinish())
            {
                randomSkillSprEvent = null;
            }
        }

        if (Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
        {
            //            #if IPHONE || ANDROID
            //            if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
            //            #else
            //            if (EventSystem.current.IsPointerOverGameObject())
            //            #endif
            //                Debug.Log("当前触摸在UI上");
            //
            //            else
            //                Debug.Log("当前没有触摸在UI上");
        }
        float gasValue = BattleInstance.instance.GetHeroCarFloatAttr(BattleInstance.instance.MyPlayerIdx, (int)Const_Util.UNIT_ATTR.NITROGEN_CUR);

        if (Mathf.Abs(gasValue - nitrogenValue) > 1)
        {
            nitrogenValue = gasValue;
            int showGas = Mathf.RoundToInt(nitrogenValue);
            if (showGas < 0)
            {
                showGas = 0;
            }
            nitrogenTxtCom.text = showGas.ToString();
            float gasMaxValue = BattleInstance.instance.GetHeroCarFloatAttr(BattleInstance.instance.MyPlayerIdx, (int)Const_Util.UNIT_ATTR.NITROGEN_MAX);
            nitrogenImgCom.fillAmount = nitrogenValue / gasMaxValue;
        }

//        int showGas = Mathf.RoundToInt(nitrogenValue);
        string strDistance = String.Format("{0:F}", BattleInstance.instance.GetHeroCarFloatAttr(TestConfig.RoleHeroPlayerIdx, (int)Const_Util.UNIT_ATTR.MOVE_DISTANCE));

        moveDistanceTextCom.text = strDistance;
    }