Пример #1
0
 private void UpdateOutOfPoison()
 {
     if (state == PoisonState.None)
     {
         return;
     }
     if (state == PoisonState.InPoisonBeforeHit || state == PoisonState.InPoisonInterval)
     {
         if (state == PoisonState.InPoisonInterval)
         {
             timeLeft = timeToClearPoison;
         }
         else
         {
             float timePercent = 1 - (timeLeft / timeToFirstPoisonHit);
             timeLeft = timePercent * timeToClearPoison;
         }
         state = PoisonState.OutOfPoison;
     }
     else if (state == PoisonState.OutOfPoison)
     {
         timeLeft -= Time.deltaTime;
         if (timeLeft <= 0)
         {
             hp.PoisonUnlockRegen();
             state = PoisonState.None;
         }
     }
 }
Пример #2
0
 private void OnStatsChange(PlayerBaseStats stats)
 {
     immune = stats.IsPoisonImmune;
     if (immune && state != PoisonState.None)
     {
         state = PoisonState.None;
     }
 }
Пример #3
0
 private void WaitingState(float dt)
 {
     if (curDurationTime >= configDurationTime)
     {
         m_poisonstate   = PoisonState.ShrinkageRing;
         curDurationTime = 0;
     }
     else
     {
         curDurationTime += dt;
     }
 }
Пример #4
0
 private void stableTime(float dt)
 {
     if (currentStableTime >= stableTimeConfig)
     {
         m_poisonstate     = PoisonState.preShrink;
         currentStableTime = 0;
         InitPoisonAndSafeCircle();
     }
     else
     {
         currentStableTime += dt;
     }
 }
Пример #5
0
    //Transform handPrefabs;

    void Start()
    {
        stats = GetComponent <Stats>();
        rb    = GetComponent <Rigidbody>();
        //handPrefabs = transform.GetChild(0);
        movement    = new Movement(this);
        movementDir = new MovementDir();
        controller  = GetComponent <CharacterController>();
        anim        = GetComponentInChildren <Animator>();
        poison      = GetComponent <PoisonState>();

        weaponManager = GameObject.Find("Weapon Manager");
        weapon        = null;
        uiManager     = UIManager.instance;
        health        = GetComponent <Health>();

        col = GetComponent <Collider>();
    }
Пример #6
0
 private void UpdateInPoison(float poisonIntensity)
 {
     if (state == PoisonState.None || state == PoisonState.OutOfPoison)
     {
         state    = PoisonState.InPoisonBeforeHit;
         timeLeft = timeToFirstPoisonHit;
         hp.PoisonBlockRegen();
     }
     else if (state == PoisonState.InPoisonBeforeHit || state == PoisonState.InPoisonInterval)
     {
         timeLeft -= Time.deltaTime * poisonIntensity;
         if (timeLeft <= 0)
         {
             damage.TakePoisonDamage();
             state    = PoisonState.InPoisonInterval;
             timeLeft = poisonHitInterval;
         }
     }
 }
Пример #7
0
    //缩毒圈
    private void shrinkPoisonCirCleRadius()
    {
        float changeradius = configReduceRadiusSpeed / 60;

        mRadius_outer -= changeradius;
        if (!CircleMathfHelper.isIntersect(mPoint_outer, mRadius_outer, mPoint_inner, mRadius_inner))
        {
            m_OutCircleChangeAction?.Invoke(mRadius_outer, mPoint_outer);
        }
        else
        {
            if (mRadius_outer > mRadius_inner)  //外圈和内圈圆心重合,半径相同
            {
                // k = y/x
                // y = kx
                // x^2+y^2 = changeradius^2
                // x^2 = 1/(k^2+1)
                float k = (mPoint_outer.y - mPoint_inner.y) / (mPoint_outer.x - mPoint_inner.x);

                float x_off = 1 * (float)Mathf.Sqrt((changeradius * changeradius) / (k * k + 1));
                // k<0  x+x_off
                mPoint_outer.x += 1 * (mPoint_outer.x < mPoint_inner.x ? 1 : -1) * x_off;
                mPoint_outer.y  = k * (mPoint_outer.x - mPoint_inner.x) + mPoint_inner.y;
                m_OutCircleChangeAction?.Invoke(mRadius_outer, mPoint_outer);
            }
            else
            {
                m_OutCircleChangeAction?.Invoke(mRadius_outer, mPoint_outer);
                refreshNewSafeCircle();
                m_poisonstate = PoisonState.preShrink;
            }
        }
        if (mRadius_outer < 1)
        {
            m_poisonstate = PoisonState.End;
        }
    }