diff --git a/Assets/Scripts/Data/Dora.cs b/Assets/Scripts/Data/Dora.cs index fb6f1e8..0f6e509 100644 --- a/Assets/Scripts/Data/Dora.cs +++ b/Assets/Scripts/Data/Dora.cs @@ -104,6 +104,7 @@ public void SellCurrentItem(int p_sellingPrice) m_grandpaLife -= System.Math.Max(stuff.m_grandpaPrice - p_sellingPrice, 0); GeneralManagement.Inst.ActualisePapyLife(Mathf.RoundToInt(m_grandpaLife * 100.0f / m_initialGrandpaLife)); m_capital += p_sellingPrice; + GeneralManagement.Inst.ActualiseCapital(m_capital); } public void SelectAnItem() diff --git a/Assets/Scripts/GeneralManagement.cs b/Assets/Scripts/GeneralManagement.cs index bb508f1..10532bf 100644 --- a/Assets/Scripts/GeneralManagement.cs +++ b/Assets/Scripts/GeneralManagement.cs @@ -117,6 +117,11 @@ public void ActualisePapyLife(int p_grandPaLifeInPercent) m_animatorPapy.SetInteger("grandpaLifeInPercent", p_grandPaLifeInPercent); } + public void ActualiseCapital(int p_capital) + { + m_animatorGeneral.SetInteger("capital", p_capital); + } + public void ShowYourBubble() { m_animatorYouBubble.SetBool("Hide", false); @@ -200,6 +205,10 @@ public void SellingAnimation() } else Stock.Inst.transform.GetChild(Dora.Inst.CurrentIndex()).GetComponent().SetBool("Hide", true); + + m_animatorGeneral.SetInteger("remainingObjects", m_animatorGeneral.GetInteger("remainingObjects") - 1); + + UpdatePickableObject(); } public void InitBuyer() @@ -272,6 +281,8 @@ public void SetPickIndex(int p_pickIndex) Stock.Inst.m_someStuff[m_pickIndex].m_grandpaPriceKnown = true; else Stock.Inst.m_someStuff[m_pickIndex].m_buyerIntrigued = true; + + UpdatePickableObject(); } public void PapyInFront() @@ -301,11 +312,15 @@ public void UpdatePickableObject() { Stock.Stuff stuff = Stock.Inst.m_someStuff[i]; - if (stuff.m_sold || (stuff.m_buyerIntrigued && stuff.m_grandpaPriceKnown)) + if (!stuff.m_sold && (!stuff.m_buyerIntrigued || !stuff.m_grandpaPriceKnown)) nbPickableObject++; } - m_animatorGeneral.SetInteger("numberOfPickableObject", nbPickableObject); + if (m_animatorGeneral.GetBool("papyHasWheelchair")) + // we musn't count the wheelchair in the pickable object + m_animatorGeneral.SetInteger("remainingPickableObjects", nbPickableObject - 1); + else + m_animatorGeneral.SetInteger("remainingPickableObjects", nbPickableObject); } /******** PROTECTED ************************/