Exemplo n.º 1
0
 private void SetState(Forge.State state)
 {
     if (this.m_State == state)
     {
         return;
     }
     this.m_State = state;
     this.OnEnterState();
 }
Exemplo n.º 2
0
 private string GetProcessIconName()
 {
     Forge.State state = this.m_State;
     if (state == Forge.State.MakingOre || state == Forge.State.MakingForm)
     {
         return("forge_melt");
     }
     return("Default_Pickup");
 }
Exemplo n.º 3
0
    public override void ConstantUpdate()
    {
        base.ConstantUpdate();
        float num  = Time.deltaTime;
        bool  flag = this.GetProcessProgress(this) < 1f;

        if (this.m_CharcoalSlot.gameObject.activeSelf != flag)
        {
            this.m_CharcoalSlot.gameObject.SetActive(flag);
        }
        if (this.m_Burning)
        {
            if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
            {
                num = Player.GetSleepTimeFactor();
            }
            this.m_BurningDuration += num;
            if (this.m_BurningDuration >= this.m_BurningLength)
            {
                this.m_BurningDuration = this.m_BurningLength;
                this.Extinguish();
            }
        }
        if (this.m_Burning)
        {
            Forge.State state = this.m_State;
            if (state != Forge.State.MakingOre)
            {
                if (state == Forge.State.MakingForm)
                {
                    if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
                    {
                        num = Player.GetSleepTimeFactor();
                    }
                    this.m_ForgingDuration += num;
                    if (this.m_ForgingDuration >= this.m_MakingFormLength)
                    {
                        this.SetState(Forge.State.Form);
                        return;
                    }
                }
            }
            else
            {
                if (SleepController.Get().IsActive() && !SleepController.Get().IsWakingUp())
                {
                    num = Player.GetSleepTimeFactor();
                }
                this.m_ForgingDuration += num;
                if (this.m_ForgingDuration >= this.m_MakingOreLength)
                {
                    this.SetState(Forge.State.Ore);
                }
            }
        }
    }
Exemplo n.º 4
0
    public float GetProcessProgress(Trigger trigger)
    {
        Item x = (Item)trigger;

        if (x == this)
        {
            return((this.m_BurningLength - this.m_BurningDuration) / this.m_BurningLength);
        }
        if (x == this.m_Item)
        {
            Forge.State state = this.m_State;
            if (state == Forge.State.MakingOre)
            {
                return(1f - (this.m_MakingOreLength - this.m_ForgingDuration) / this.m_MakingOreLength);
            }
            if (state == Forge.State.MakingForm)
            {
                return(1f - (this.m_MakingFormLength - this.m_ForgingDuration) / this.m_MakingFormLength);
            }
        }
        return(0f);
    }