-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vertical Elements: Add ups/downs and their animations.
- Loading branch information
1 parent
539398b
commit ee51579
Showing
8 changed files
with
317 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using UnityEngine; | ||
public class CaretManager | ||
{ | ||
private int upCaretsDegreeRotateTop = 0; | ||
private int upCaretsDegreeRotateMid = 0; | ||
private int upCaretsDegreeRotateBot = 0; | ||
private int upCaretsFrame = 0; | ||
private int downCaretsDegreeRotateTop = 0; | ||
private int downCaretsDegreeRotateMid = 0; | ||
private int downCaretsDegreeRotateBot = 0; | ||
private int downCaretsFrame = 0; | ||
private const int ROTATE_DEG_Y = 6; | ||
private const int ROTATE_DEF_HALF_ROT = 180; | ||
|
||
public CaretManager() | ||
{ | ||
} | ||
|
||
public void Enable(GameObject CanvasObj) | ||
{ | ||
CanvasObj.transform.Find("UpCarets").gameObject.SetActive(true); | ||
CanvasObj.transform.Find("DownCarets").gameObject.SetActive(true); | ||
} | ||
|
||
public void Disable(GameObject CanvasObj) | ||
{ | ||
CanvasObj.transform.Find("UpCarets").gameObject.SetActive(false); | ||
CanvasObj.transform.Find("DownCarets").gameObject.SetActive(false); | ||
} | ||
|
||
public void TriggerCarets(StyleStar.Motion currMotion) | ||
{ | ||
if (currMotion == StyleStar.Motion.Down) | ||
{ | ||
downCaretsDegreeRotateTop += ROTATE_DEF_HALF_ROT; | ||
downCaretsFrame += 60; | ||
} | ||
else if (currMotion == StyleStar.Motion.Up) | ||
{ | ||
upCaretsDegreeRotateTop += ROTATE_DEF_HALF_ROT; | ||
upCaretsFrame += 60; | ||
} | ||
} | ||
|
||
public void AnimateCarets(GameObject CanvasObj) | ||
{ | ||
var downCarets = CanvasObj.transform.Find("DownCarets"); | ||
if (downCaretsDegreeRotateTop > 0) | ||
{ | ||
downCarets.Find("DownCaret0").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
if (downCaretsFrame % 60 == 45) // 0.25 seconds | ||
downCaretsDegreeRotateMid += ROTATE_DEF_HALF_ROT; | ||
downCaretsDegreeRotateTop -= ROTATE_DEG_Y; | ||
|
||
} | ||
if (downCaretsDegreeRotateMid > 0) | ||
{ | ||
downCarets.Find("DownCaret1").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
if (downCaretsFrame % 60 == 30) // 0.5 seconds | ||
downCaretsDegreeRotateBot += ROTATE_DEF_HALF_ROT; | ||
downCaretsDegreeRotateMid -= ROTATE_DEG_Y; | ||
} | ||
if (downCaretsDegreeRotateBot > 0) | ||
{ | ||
downCarets.Find("DownCaret2").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
downCaretsDegreeRotateBot -= ROTATE_DEG_Y; | ||
} | ||
if (downCaretsFrame >= 1) | ||
downCaretsFrame--; | ||
|
||
var upCarets = CanvasObj.transform.Find("UpCarets"); | ||
if (upCaretsDegreeRotateTop > 0) | ||
{ | ||
upCarets.Find("UpCaret0").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
if (upCaretsFrame % 60 == 45) // 0.25 seconds | ||
upCaretsDegreeRotateMid += ROTATE_DEF_HALF_ROT; | ||
upCaretsDegreeRotateTop -= ROTATE_DEG_Y; | ||
|
||
} | ||
if (upCaretsDegreeRotateMid > 0) | ||
{ | ||
upCarets.Find("UpCaret1").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
if (upCaretsFrame % 60 == 30) // 0.5 seconds | ||
upCaretsDegreeRotateBot += ROTATE_DEF_HALF_ROT; | ||
upCaretsDegreeRotateMid -= ROTATE_DEG_Y; | ||
} | ||
if (upCaretsDegreeRotateBot > 0) | ||
{ | ||
upCarets.Find("UpCaret2").transform.Rotate(new Vector3(0, 1, 0), ROTATE_DEG_Y); | ||
upCaretsDegreeRotateBot -= ROTATE_DEG_Y; | ||
} | ||
if (upCaretsFrame >= 1) | ||
upCaretsFrame--; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/Screens/GameplayScreen/CaretManager.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.