Skip to content

Commit

Permalink
[FCT] some update of the animator parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopheClaustre committed Dec 5, 2018
1 parent 7ae9750 commit 8282602
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Assets/Scripts/Data/Dora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 17 additions & 2 deletions Assets/Scripts/GeneralManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -200,6 +205,10 @@ public void SellingAnimation()
}
else
Stock.Inst.transform.GetChild(Dora.Inst.CurrentIndex()).GetComponent<Animator>().SetBool("Hide", true);

m_animatorGeneral.SetInteger("remainingObjects", m_animatorGeneral.GetInteger("remainingObjects") - 1);

UpdatePickableObject();
}

public void InitBuyer()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 ************************/
Expand Down

0 comments on commit 8282602

Please sign in to comment.