Skip to content

Commit

Permalink
Finish ouchi color
Browse files Browse the repository at this point in the history
  • Loading branch information
syKevinPeng committed Apr 30, 2024
1 parent c64b5a0 commit 7579d84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Assets/Scripts/IllusionPatternLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Start()
RawImage = GameObject.Find("RawImage");

abstractIllusionPattern ouchiLength = new ouchiLength(stepSize: 0.1f);
abstractIllusionPattern ouchiColor = new ouchiColor(stepSize: 0.05f);
abstractIllusionPattern ouchiColor = new ouchiColor(stepSize: 0.04f);

allPatterns.Add(ouchiLength);
allPatterns.Add(ouchiColor);
Expand Down
11 changes: 8 additions & 3 deletions Assets/Scripts/illusions/ouchiColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override float GetCurrentRatio()
Debug.LogWarning("ForegroundColor: " + foregroundColor + " BackgroundColor: " + backgroundColor);
if (foregroundColor == 0)
{
return 0.0f;
return 10f;
}
else
{
Expand All @@ -66,17 +66,22 @@ public override float GetInitRatio()
public override void DecreasePatternRatio()
{

if (foregroundColor + stepSize <= 1.0f)
if (backgroundColor > foregroundColor)
{
foregroundColor += stepSize;
backgroundColor -= stepSize;
}
else
{
foregroundColor = backgroundColor = 0.5f;
}

texture = GeneratePattern();
}

public override void IncreasePatternRatio()
{
if (backgroundColor >= foregroundColor)
if (foregroundColor - stepSize >= 0.0f)
{
backgroundColor += stepSize;
foregroundColor -= stepSize;
Expand Down

0 comments on commit 7579d84

Please sign in to comment.