Skip to content

Commit

Permalink
fix: Minor Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
christiankyle-ching committed Nov 16, 2021
1 parent 85789f3 commit 5541c61
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Assets/Prefabs/SP/SPCardInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ public static Sprite GetColoredSprite(CARDCOLOR color)
return Resources.Load<Sprite>("Cards/Templates/Orange");
}
}

public void RevealCard()
{
isRevealed = true;
GetComponent<Animator>().SetTrigger("Correct");
}
}
11 changes: 9 additions & 2 deletions Assets/Prefabs/SP/SPCardZoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ void ZoomCard()
zoomCard = Instantiate(zoomCardPrefab);
zoomCard.transform.SetParent(canvas, false);
zoomCard.transform.localPosition = new Vector2(0f, 0f);

CardData data = GetComponent<SPCardInfo>().cardData;
zoomCard.GetComponent<SPCardInfo>().InitCardData(data);
zoomCard.GetComponent<Animator>().SetTrigger("Zoom");
if (GetComponent<SPCardInfo>().isRevealed)
{
zoomCard.GetComponent<Animator>().SetTrigger("ZoomWithYear");
}
else
{
zoomCard.GetComponent<Animator>().SetTrigger("Zoom");
}
}

public void UnzoomCard()
Expand Down
1 change: 0 additions & 1 deletion Assets/Prefabs/SP/SPDragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public void OnDiscard()

public void OnPlaceCorrect()
{
GetComponent<Animator>().SetTrigger("Correct");
DisableDrag();
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Game & Assessment/MP/MPGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public void OnPlayerQuit(string playerName, bool isHost = false)

// TODO: Set in Prod
[Range(0f, 1f)]
private float specialActionRate = 0.15f; // 0.0 to 1.0 = Percentage of special action
private float specialActionRate = 0.3f; // 0.0 to 1.0 = Percentage of special action

public SPECIALACTION GetRandomSpecialAction()
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Game & Assessment/MP/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public void TargetPeekCard(NetworkConnection conn)

if (cardCount > 0)
{
int randIndex = UnityEngine.Random.Range(0, cardCount);
int randIndex = UnityEngine.Random.Range(0, cardCount - 1);
playerArea.transform.GetChild(randIndex).GetComponent<MPCardInfo>().RevealCard();
}
}
Expand Down
8 changes: 7 additions & 1 deletion Assets/Scripts/Game & Assessment/SP/SPGameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ public void HandleDropInTimeline(GameObject droppedCard, int dropPos)
{
droppedCard.GetComponent<SPDragDrop>().ReplacePlaceholder();
droppedCard.GetComponent<SPDragDrop>().OnPlaceCorrect();
droppedCard.GetComponent<SPCardInfo>().RevealCard();

playerStats.CorrectDrop();

messenger.ShowMessage("Good Job! That's correct.", MPGameMessageType.CORRECT);
Expand Down Expand Up @@ -446,7 +448,11 @@ private void SpawnCard(CardData data, Transform container, bool showYear = false
card.GetComponent<SPCardInfo>().cardData = data;
card.GetComponent<SPCardInfo>().InitCardData(data);

if (showYear) card.GetComponent<SPDragDrop>().OnPlaceCorrect();
if (showYear)
{
card.GetComponent<SPDragDrop>().OnPlaceCorrect();
card.GetComponent<SPCardInfo>().RevealCard();
}

card.transform.SetParent(container, false);
}
Expand Down

0 comments on commit 5541c61

Please sign in to comment.