Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction Direction variable name #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Assets/Scripts/BlockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
public class BlockManager : MonoBehaviour
{

enum Dircetion { x, z }
enum Direction { x, z }
enum BlockState { perfect, good, fail}

GameSettingData gameData;
public BackgroundColorManager background;

GameObject currentBlock, preBlock;
Dircetion currentDirection = Dircetion.x;
Direction currentDirection = Direction.x;
Vector3 currentBlockScale;


Expand Down Expand Up @@ -83,7 +83,7 @@ IEnumerator OnUpdate()
var spawnPos = new Vector3();
var movePos = new Vector3();

if (currentDirection == Dircetion.x)
if (currentDirection == Direction.x)
{
spawnPos.x = -gameData.blockSpawnDistance + preBlock.transform.position.x;
spawnPos.y = currentBlockCount;
Expand Down Expand Up @@ -132,7 +132,7 @@ IEnumerator OnUpdate()
}

MoveCam();
currentDirection = (currentDirection == Dircetion.x)? Dircetion.z : Dircetion.x;
currentDirection = (currentDirection == Direction.x)? Direction.z : Direction.x;

yield return null;
}
Expand All @@ -158,7 +158,7 @@ void OnBlockPerfect()
Vector3 targetBlockScale = currentBlock.transform.localScale;
bool blockScaleDirection;

if (currentDirection == Dircetion.x)
if (currentDirection == Direction.x)
{
if (currentBlock.transform.localScale.x + gameData.perfectScale > gameData.initialBlockScale.x)
{
Expand Down Expand Up @@ -265,7 +265,7 @@ GameObject CutBlock(GameObject block, Vector3 targetPos)

float distance = Vector2.Distance(new Vector2(blockPos.x, blockPos.z), new Vector2(targetPos.x, targetPos.z));

if(currentDirection == Dircetion.x)
if(currentDirection == Direction.x)
{

block.transform.position = new Vector3( (targetPos.x + blockPos.x) / 2f, blockPos.y, blockPos.z);
Expand Down Expand Up @@ -296,14 +296,14 @@ BlockState CheckState(GameObject block, GameObject target)
{


float dis = currentDirection == Dircetion.x ?
float dis = currentDirection == Direction.x ?
Mathf.Abs(block.transform.position.x - target.transform.position.x)
: Mathf.Abs(block.transform.position.z - target.transform.position.z);

if (dis < gameData.minDistance) return BlockState.perfect;
else
{
float scale = currentDirection == Dircetion.x ? block.transform.localScale.x : block.transform.localScale.z;
float scale = currentDirection == Direction.x ? block.transform.localScale.x : block.transform.localScale.z;

if (scale > dis)
{
Expand Down