public void TargetAbsoluteSpeed(float targetSpeed, float changeRate, string boostName = "")
    {
        Interrupt();

        this.targetSpeed = targetSpeed;
        if (boostName == null)
        {
            boostName = "";
        }
        this.boostName = boostName;

        if (changeRate <= 0)
        {
            boostLeft      = 0;
            boostIncrement = 0;
            boostStatus    = BoostStatus.STABLE;
            SendMessage("EndSpeedChange", boostName, SendMessageOptions.DontRequireReceiver);
            boostName = "";
            return;
        }

        if (targetSpeed >= mover.maxSpeed)
        {
            boostLeft      = 1 / changeRate;
            boostIncrement = (targetSpeed - mover.maxSpeed) * changeRate;
            boostStatus    = BoostStatus.BOOST;
        }
        else
        {
            boostLeft      = 1 / changeRate;
            boostIncrement = (targetSpeed - mover.maxSpeed) * changeRate;
            boostStatus    = BoostStatus.DRAIN;
        }
    }
 private void Update()
 {
     if (enableBoostList.Count > 0)
     {
         DateTime now  = TimeManager.GetNow();
         bool     flag = false;
         if (time != now.Second)
         {
             time = now.Second;
             int i = 0;
             for (int count = enableBoostList.Count; i < count; i++)
             {
                 BoostStatus boostStatus = enableBoostList[i];
                 if (!boostStatus.IsRemain())
                 {
                     deleteBoostList.Add(boostStatus);
                     if (boostDispType == (USE_ITEM_EFFECT_TYPE)boostStatus.type)
                     {
                         flag = true;
                     }
                 }
             }
             bool flag2 = false;
             if (deleteBoostList.Count > 0)
             {
                 flag2 = true;
                 int j = 0;
                 for (int count2 = deleteBoostList.Count; j < count2; j++)
                 {
                     BoostStatus delete_boost = deleteBoostList[j];
                     enableBoostList.RemoveAll((BoostStatus data) => data.type == delete_boost.type);
                 }
                 deleteBoostList.Clear();
             }
             if (flag2)
             {
                 CreateAnimTable();
             }
             if (enableBoostList.Count > 0)
             {
                 updataCnt++;
                 if (flag || updataCnt >= 3)
                 {
                     ShowNextBoost(flag);
                     updataCnt = 0;
                 }
                 else
                 {
                     updateCallback(GetShowBoostStatus());
                 }
             }
             else
             {
                 updataCnt = 0;
                 EndShowBoost();
             }
         }
     }
 }
Esempio n. 3
0
 private void UpdateShowBoost(BoostStatus boost)
 {
     //IL_0046: Unknown result type (might be due to invalid IL or missing references)
     switch (boost.type)
     {
     case 1:
     case 2:
     case 3:
     case 201:
         SetColor((Enum)UI.LBL_BOOST_RATE, boostAnimator.GetRateColor(boost.value));
         SetLabelText((Enum)UI.LBL_BOOST_RATE, boost.GetBoostRateText());
         SetLabelText((Enum)UI.LBL_BOOST_TIME, boost.GetRemainTime());
         break;
     }
 }
 private void UpdateShowBoost(BoostStatus boost)
 {
     //IL_0055: Unknown result type (might be due to invalid IL or missing references)
     switch (boost.type)
     {
     case 1:
     case 2:
     case 3:
     case 201:
         boostRate.text  = boost.GetBoostRateText();
         boostRate.color = boostAnimator.GetRateColor(boost.value);
         boostTime.text  = boost.GetRemainTime();
         break;
     }
 }
    public void SetupUI(Action <BoostStatus> update_callback, Action <BoostStatus> change_callback)
    {
        enableBoostList.Clear();
        BoostStatus boostStatus = MonoBehaviourSingleton <StatusManager> .I.GetBoostStatus(USE_ITEM_EFFECT_TYPE.EXP_UP);

        if (boostStatus != null)
        {
            enableBoostList.Add(boostStatus);
        }
        BoostStatus boostStatus2 = MonoBehaviourSingleton <StatusManager> .I.GetBoostStatus(USE_ITEM_EFFECT_TYPE.MONEY_UP);

        if (boostStatus2 != null)
        {
            enableBoostList.Add(boostStatus2);
        }
        BoostStatus boostStatus3 = MonoBehaviourSingleton <StatusManager> .I.GetBoostStatus(USE_ITEM_EFFECT_TYPE.DROP_UP);

        if (boostStatus3 != null)
        {
            enableBoostList.Add(boostStatus3);
        }
        BoostStatus boostStatus4 = MonoBehaviourSingleton <StatusManager> .I.GetBoostStatus(USE_ITEM_EFFECT_TYPE.EVENT_POINT_UP);

        if (boostStatus4 != null)
        {
            if (!MonoBehaviourSingleton <UIPlayerStatus> .IsValid() && !MonoBehaviourSingleton <UIEnduranceStatus> .IsValid())
            {
                enableBoostList.Add(boostStatus4);
            }
            else if (MonoBehaviourSingleton <UIPlayerStatus> .IsValid() && MonoBehaviourSingleton <UIPlayerStatus> .I.PermitHGPBoostUpdate)
            {
                enableBoostList.Add(boostStatus4);
            }
            else if (MonoBehaviourSingleton <UIEnduranceStatus> .IsValid() && MonoBehaviourSingleton <UIEnduranceStatus> .I.PermitHGPBoostUpdate)
            {
                enableBoostList.Add(boostStatus4);
            }
        }
        USE_ITEM_EFFECT_TYPE uSE_ITEM_EFFECT_TYPE = boostDispType;

        CreateAnimTable();
        updateCallback = update_callback;
        changeCallback = change_callback;
        if (uSE_ITEM_EFFECT_TYPE != boostDispType || boostDispType == USE_ITEM_EFFECT_TYPE.NONE)
        {
            changeCallback(GetShowBoostStatus());
        }
    }
	void Update()
	{
		if (boostStatus != BoostStatus.STABLE)
		{
			boostLeft -= Time.deltaTime;
			mover.maxSpeed = mover.maxSpeed + (boostIncrement * Time.deltaTime);
			bool boostEnded = false;
			if (boostStatus == BoostStatus.BOOST)
			{
				if (mover.maxSpeed >= targetSpeed)
				{
					mover.maxSpeed = targetSpeed;
					boostEnded = true;
				}
				if (boostEnded || boostLeft <= 0)
				{
					SendMessage("EndSpeedBoost", boostName, SendMessageOptions.DontRequireReceiver);
					boostEnded = true;
				}
			}
			else
			{
				if (mover.maxSpeed <= targetSpeed)
				{
					mover.maxSpeed = targetSpeed;
					boostEnded = true;
				}
				if (boostEnded || boostLeft <= 0)
				{
					SendMessage("EndSpeedDrainEnd", boostName, SendMessageOptions.DontRequireReceiver);
					boostEnded = true;
				}
			}

			if (boostEnded)
			{
				boostLeft = 0;
				boostIncrement = 0;
				boostStatus = BoostStatus.STABLE;
				SendMessage("EndSpeedChange", boostName, SendMessageOptions.DontRequireReceiver);
				boostName = "";
			}
		}
	}
    void Update()
    {
        if (boostStatus != BoostStatus.STABLE)
        {
            boostLeft     -= Time.deltaTime;
            mover.maxSpeed = mover.maxSpeed + (boostIncrement * Time.deltaTime);
            bool boostEnded = false;
            if (boostStatus == BoostStatus.BOOST)
            {
                if (mover.maxSpeed >= targetSpeed)
                {
                    mover.maxSpeed = targetSpeed;
                    boostEnded     = true;
                }
                if (boostEnded || boostLeft <= 0)
                {
                    SendMessage("EndSpeedBoost", boostName, SendMessageOptions.DontRequireReceiver);
                    boostEnded = true;
                }
            }
            else
            {
                if (mover.maxSpeed <= targetSpeed)
                {
                    mover.maxSpeed = targetSpeed;
                    boostEnded     = true;
                }
                if (boostEnded || boostLeft <= 0)
                {
                    SendMessage("EndSpeedDrainEnd", boostName, SendMessageOptions.DontRequireReceiver);
                    boostEnded = true;
                }
            }

            if (boostEnded)
            {
                boostLeft      = 0;
                boostIncrement = 0;
                boostStatus    = BoostStatus.STABLE;
                SendMessage("EndSpeedChange", boostName, SendMessageOptions.DontRequireReceiver);
                boostName = "";
            }
        }
    }
	public void TargetAbsoluteSpeed(float targetSpeed, float changeRate, string boostName = "")
	{
		Interrupt();

		this.targetSpeed = targetSpeed;
		if (boostName == null)
		{
			boostName = "";
		}
		this.boostName = boostName;

		if (changeRate <= 0)
		{
			boostLeft = 0;
			boostIncrement = 0;
			boostStatus = BoostStatus.STABLE;
			SendMessage("EndSpeedChange", boostName, SendMessageOptions.DontRequireReceiver);
			boostName = "";
			return;
		}

		if (targetSpeed >= mover.maxSpeed)
		{
			boostLeft = 1 / changeRate;
			boostIncrement = (targetSpeed - mover.maxSpeed) * changeRate;
			boostStatus = BoostStatus.BOOST;
		}
		else
		{
			boostLeft = 1 / changeRate;
			boostIncrement = (targetSpeed - mover.maxSpeed) * changeRate;
			boostStatus = BoostStatus.DRAIN;
		}
	}