Skip to content

Commit

Permalink
- Added a separate slider for helper token scale - Added the screensh…
Browse files Browse the repository at this point in the history
…ot button to the Widow - Various bug fixes
  • Loading branch information
ddbrown30 committed Jun 23, 2020
1 parent ccf569f commit 201f2c4
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 25 deletions.
22 changes: 17 additions & 5 deletions Assets/GrimoireManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class GrimoireManager : MonoBehaviour

public float MinTokenScale = 0.5f;
public float MaxTokenScale = 2f;
public Slider ScaleSlider;
public Slider RoleScaleSlider;
public Slider HelperScaleSlider;

private float TownRadius;
public float MinTokenRadius = 300f;
Expand Down Expand Up @@ -92,7 +93,8 @@ public void AddToken(RoleData roleData)
grimoireToken.AddHelperToken(helperToken);
}

grimoireToken.SetScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, ScaleSlider.value));
grimoireToken.SetRoleTokenScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, RoleScaleSlider.value));
grimoireToken.SetHelperTokenScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, HelperScaleSlider.value));

UpdateGrimoire();
UpdateRoleCounts();
Expand Down Expand Up @@ -304,13 +306,23 @@ public void OnClickRandomize()
ModalPanel.MessageBox("Randomize player positions?", RandomizeGrimoire, null, null, null, "YesNo");
}

public void ScaleSliderChanged(float value)
public void RoleScaleSliderChanged(float value)
{
Vector2 scale = Vector3.one * Mathf.Lerp(MinTokenScale, MaxTokenScale, value);

foreach (var token in RoleTokens)
{
token.SetScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, ScaleSlider.value));
token.SetRoleTokenScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, RoleScaleSlider.value));
}
}

public void HelperScaleSliderChanged(float value)
{
Vector2 scale = Vector3.one * Mathf.Lerp(MinTokenScale, MaxTokenScale, value);

foreach (var token in RoleTokens)
{
token.SetHelperTokenScale(Mathf.Lerp(MinTokenScale, MaxTokenScale, HelperScaleSlider.value));
}

foreach (var token in AlignmentTokens)
Expand Down Expand Up @@ -346,7 +358,7 @@ public void AddAlignmentToken()
GameObject tokenObj = Instantiate(AlignmentTokenPrefab);
tokenObj.GetComponent<RectTransform>().anchoredPosition = gameObject.GetComponent<RectTransform>().anchoredPosition;
tokenObj.transform.SetParent(AlignmentTokenAttach.transform);
tokenObj.transform.localScale = Vector3.one * Mathf.Lerp(MinTokenScale, MaxTokenScale, ScaleSlider.value);
tokenObj.transform.localScale = Vector3.one * Mathf.Lerp(MinTokenScale, MaxTokenScale, HelperScaleSlider.value);
tokenObj.transform.localPosition = Vector3.zero;
AlignmentTokens.Add(tokenObj);
}
Expand Down
6 changes: 5 additions & 1 deletion Assets/GrimoireToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ public void SetIsBluffToken()
GetComponentInChildren<Button>().enabled = false;
}

public void SetScale(float scale)
public void SetRoleTokenScale(float scale)
{
transform.localScale = Vector3.one * scale;
}

public void SetHelperTokenScale(float scale)
{
foreach (var token in HelperTokens)
{
token.transform.localScale = Vector3.one * scale;
Expand Down
2 changes: 1 addition & 1 deletion Assets/HelperTokenPrefab.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_SizeDelta: {x: 80, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2645495215630745708
CanvasRenderer:
Expand Down
2 changes: 1 addition & 1 deletion Assets/NightEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NightEntry : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
public void SetRoleData(RoleData roleData)
{
RoleData = roleData;
if (RoleData && RoleData.RoleName == "Spy")
if (RoleData && (RoleData.RoleName == "Spy" || RoleData.RoleName == "Widow"))
TakeScreenshotButton.SetActive(true);
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/RoleData/Unreleased/Townsfolk/FishermanData.asset
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MonoBehaviour:
RoleName: Fisherman
RoleType: 0
FirstNightOrder: -1
OtherNightOrder: 29
OtherNightOrder: -1
IsNightOrderAfterDawn: 0
RoleTokenSprite: {fileID: 21300000, guid: e9074df03c8171e4f980c5638c82b509, type: 3}
HelperTokenSprites:
Expand Down
Loading

0 comments on commit 201f2c4

Please sign in to comment.