Skip to content

Commit

Permalink
Merge pull request #24 from Accessible-Technology-in-Sign/issue_repla…
Browse files Browse the repository at this point in the history
…ce_-chicken-
  • Loading branch information
dominoweir authored Apr 5, 2021
2 parents 85b1404 + 6951ca7 commit d74a0be
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Resources/WordBanks/FullWordBank.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ penguin
rooster
frog
sheep
chicken
star
tiger
cow
bird
Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Resources/WordIcons/FullWordBank.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ penguin
rooster
frog
sheep
chicken
star
tiger
cow
bird
Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Resources/words.json
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@
"folderName": "Animals",
"frameNumber": 61
},
"chicken": {
"star": {
"folderName": "Animals",
"frameNumber": 45
},
Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Scripts/Bubbles/ColorBallScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum BallColor
violet,
yellow,
random,
chicken
star
}

public class ColorBallScript : MonoBehaviour {
Expand Down
4 changes: 2 additions & 2 deletions Assets/PopSignMain/Scripts/Bubbles/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public GameObject Busy

// value.GetComponent<SpriteRenderer>().sortingOrder = Mathf.FloorToInt( 1 / ( transform.position.y + 10 ) * 100 );
value.GetComponent<ball>().mesh = gameObject;
if( value.tag == "chicken" ) value.GetComponent<SpriteRenderer>().sortingOrder = 100;
if( value.tag == "star" ) value.GetComponent<SpriteRenderer>().sortingOrder = 100;
}
}

Expand All @@ -45,7 +45,7 @@ void Update()
// if the box is empty, create a new ball for it
if( name == "boxCatapult" && !Grid.waitForAnim )
{
if( ( GamePlay.Instance.GameStatus == GameState.Playing || GamePlay.Instance.GameStatus == GameState.Win || GamePlay.Instance.GameStatus == GameState.WaitForChicken ) && LevelData.LimitAmount > 0 )
if( ( GamePlay.Instance.GameStatus == GameState.Playing || GamePlay.Instance.GameStatus == GameState.Win || GamePlay.Instance.GameStatus == GameState.WaitForStar ) && LevelData.LimitAmount > 0 )
{
busy = Camera.main.GetComponent<mainscript>().createCannonBall( transform.position );
GameObject ball = boxCatapult.GetComponent<Grid>().busy;
Expand Down
17 changes: 8 additions & 9 deletions Assets/PopSignMain/Scripts/Bubbles/ball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ void Update()
{
//Checks if current video is right video for ball
//If ball has not been launched and target has not been set and no new ball is being swapped in and a current ball exists
//and the game is currently in "play" mode or "wait for chicken" mode?
//and the game is currently in "play" mode or "wait for star" mode?
if (!launched && !gameObject.GetComponent<ball>().setTarget &&
mainscript.Instance.newBall2 == null &&
newBall && !Camera.main.GetComponent<mainscript>().gameOver &&
(GamePlay.Instance.GameStatus == GameState.Playing ||
GamePlay.Instance.GameStatus == GameState.WaitForChicken))
GamePlay.Instance.GameStatus == GameState.WaitForStar))
{
Video ballVideo = this.sharedVideoManager.getVideoByColor(gameObject.GetComponent<ColorBallScript>().mainColor);
// If the current video doesn't exist or is not the video that matches the current ball, set it to the right video
Expand All @@ -106,7 +106,7 @@ void Update()
!ball.GetComponent<ball>().setTarget && mainscript.Instance.newBall2 == null &&
!Camera.main.GetComponent<mainscript>().gameOver &&
(GamePlay.Instance.GameStatus == GameState.Playing ||
GamePlay.Instance.GameStatus == GameState.WaitForChicken))
GamePlay.Instance.GameStatus == GameState.WaitForStar))
{
//Get the position of the click
Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Expand Down Expand Up @@ -180,7 +180,7 @@ void Update()
if ((transform.position.y <= -10 || transform.position.y >= 5) && fireBall && !Destroyed)
{
Debug.Log("transform.position.y: " + transform.position.y);
mainscript.Instance.CheckFreeChicken();
mainscript.Instance.CheckFreeStar();
setTarget = false;
launched = false;
DestroySingle(gameObject, 0.00001f);
Expand All @@ -189,7 +189,6 @@ void Update()
if ((transform.position.y <= -10 || transform.position.y >= 5) && !Destroyed)
{
Debug.Log("transform.position.y: " + transform.position.y);
// mainscript.Instance.CheckFreeChicken();
setTarget = false;
launched = false;
DestroySingle(gameObject, 0.00001f);
Expand Down Expand Up @@ -305,7 +304,7 @@ public void checkNearestColor()
score += ballsToClear.Count * 50;
destroy(ballsToClear, 0.00001f);
mainscript.Score = score;
mainscript.Instance.CheckFreeChicken();
mainscript.Instance.CheckFreeStar();
} else {
whiff = true;
}
Expand Down Expand Up @@ -385,7 +384,7 @@ IEnumerator FlyToTarget()
// the arraylist is updated to contain all the near balls, which is then passed to destroy()
public bool checkNearestBall(ArrayList b)
{
if ((mainscript.Instance.TopBorder.transform.position.y - transform.position.y <= 0 && LevelData.mode != ModeGame.Rounded) || (LevelData.mode == ModeGame.Rounded && tag == "chicken"))
if ((mainscript.Instance.TopBorder.transform.position.y - transform.position.y <= 0 && LevelData.mode != ModeGame.Rounded) || (LevelData.mode == ModeGame.Rounded && tag == "star"))
{
b.Clear();
return true; // don't destroy
Expand Down Expand Up @@ -557,7 +556,7 @@ public IEnumerator PlayHitAnimCor(Vector3 newBallPos, float force, Hashtable ani
{
animStarted = true;
animTable.Add(gameObject, gameObject);
if (tag == "chicken") yield break;
if (tag == "star") yield break;
yield return new WaitForFixedUpdate();
float dist = Vector3.Distance(transform.position, newBallPos);
force = 1 / dist + force;
Expand Down Expand Up @@ -645,7 +644,7 @@ void OnTriggerEnter2D(Collider2D other)
StopBall(true, other.transform);
else
{
if (other.gameObject.tag.Contains("animal") || other.gameObject.tag.Contains("empty") || other.gameObject.tag.Contains("chicken")) return;
if (other.gameObject.tag.Contains("animal") || other.gameObject.tag.Contains("empty") || other.gameObject.tag.Contains("star")) return;
fireBallLimit--;
if (fireBallLimit > 0)
DestroySingle(other.gameObject, 0.000000000001f);
Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Scripts/Bubbles/creatorBall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public GameObject createBall( Vector3 vec, BallColor color = BallColor.random, b
GameObject imageObject = new GameObject();
imageObject.transform.parent = b.transform;
SpriteRenderer ballImage = imageObject.AddComponent<SpriteRenderer> ();
if (b.GetComponent<ColorBallScript> ().mainColor != BallColor.chicken) {
if (b.GetComponent<ColorBallScript> ().mainColor != BallColor.star) {
string imageName = sharedVideoManager.getVideoByColor (b.GetComponent<ColorBallScript> ().mainColor).imageName;
ballImage.sprite = (Sprite)Resources.Load(imageName, typeof(Sprite));
ballImage.sortingLayerName = "WordIconsLayer";
Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Scripts/Core/GamePlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum GameState
BlockedGame,
Tutorial,
PreTutorial,
WaitForChicken
WaitForStar
}


Expand Down
2 changes: 1 addition & 1 deletion Assets/PopSignMain/Scripts/Core/InitScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public enum Target
{
Top = 0,
Chicken
Star
}

namespace InitScriptName
Expand Down
44 changes: 22 additions & 22 deletions Assets/PopSignMain/Scripts/Core/mainscript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void Update ()
}

// if there are balls to clear
if( flyingBall != null && ( GamePlay.Instance.GameStatus == GameState.Playing || GamePlay.Instance.GameStatus == GameState.WaitForChicken ))
if( flyingBall != null && ( GamePlay.Instance.GameStatus == GameState.Playing || GamePlay.Instance.GameStatus == GameState.WaitForStar ))
{
// this line decides which balls to pop
flyingBall.GetComponent<ball>().checkNearestColor();
Expand Down Expand Up @@ -306,7 +306,7 @@ void Update ()
}
if( LevelData.mode == ModeGame.Vertical && TargetCounter == MustPopCount && GamePlay.Instance.GameStatus == GameState.Playing )
GamePlay.Instance.GameStatus = GameState.Win;
else if( LevelData.mode == ModeGame.Rounded && TargetCounter >= 1 && GamePlay.Instance.GameStatus == GameState.WaitForChicken )
else if( LevelData.mode == ModeGame.Rounded && TargetCounter >= 1 && GamePlay.Instance.GameStatus == GameState.WaitForStar )
GamePlay.Instance.GameStatus = GameState.Win;
else if( LevelData.mode == ModeGame.Animals && TargetCounter >= TotalTargets && GamePlay.Instance.GameStatus == GameState.Playing )
GamePlay.Instance.GameStatus = GameState.Win;
Expand Down Expand Up @@ -501,7 +501,7 @@ public void GetColorsInGame()
colorsDict.Clear();
foreach( Transform item in Balls )
{
if( item.tag == "chicken" || item.tag == "empty" || item.tag == "Ball" ) continue;
if( item.tag == "star" || item.tag == "empty" || item.tag == "Ball" ) continue;
BallColor col = (BallColor)System.Enum.Parse( typeof( BallColor ), item.tag );
if( !colorsDict.ContainsValue( col ) && (int)col <= (int) BallColor.random)
{
Expand All @@ -511,17 +511,17 @@ public void GetColorsInGame()
}
}

public void CheckFreeChicken()
public void CheckFreeStar()
{
if( LevelData.mode != ModeGame.Rounded ) return;
if(GamePlay.Instance.GameStatus == GameState.Playing)
StartCoroutine( CheckFreeChickenCor() );
StartCoroutine( CheckFreeStarCor() );
}

IEnumerator CheckFreeChickenCor()
IEnumerator CheckFreeStarCor()
{
// yield return new WaitForSeconds( Mathf.Clamp( (float)countOfPreparedToDestroy / 100, 1.5f, (float)countOfPreparedToDestroy / 100 ) );
GamePlay.Instance.GameStatus = GameState.WaitForChicken;
GamePlay.Instance.GameStatus = GameState.WaitForStar;
yield return new WaitForSeconds( 1.5f );
bool finishGame = false;
if( LevelData.mode == ModeGame.Rounded )
Expand All @@ -531,7 +531,7 @@ IEnumerator CheckFreeChickenCor()
GameObject balls = GameObject.Find( "-Ball" );
foreach( Transform item in balls.transform )
{
if( item.tag != "Ball" && item.tag != "chicken" )
if( item.tag != "Ball" && item.tag != "star" )
{
finishGame = false;
}
Expand All @@ -544,26 +544,26 @@ IEnumerator CheckFreeChickenCor()
}
else if( finishGame )
{
GamePlay.Instance.GameStatus = GameState.WaitForChicken;
GamePlay.Instance.GameStatus = GameState.WaitForStar;

GameObject chicken = GameObject.FindGameObjectWithTag( "chicken" );
chicken.GetComponent<SpriteRenderer>().sortingLayerName = "UI layer";
GameObject star = GameObject.FindGameObjectWithTag( "star" );
star.GetComponent<SpriteRenderer>().sortingLayerName = "UI layer";
Vector3 targetPos = new Vector3( 2.3f, 6, 0 );
mainscript.Instance.TargetCounter++;
AnimationCurve curveX = new AnimationCurve( new Keyframe( 0, chicken.transform.position.x ), new Keyframe( 0.5f, targetPos.x ) );
AnimationCurve curveY = new AnimationCurve( new Keyframe( 0, chicken.transform.position.y ), new Keyframe( 0.5f, targetPos.y ) );
curveY.AddKey( 0.2f, chicken.transform.position.y - 1 );
AnimationCurve curveX = new AnimationCurve( new Keyframe( 0, star.transform.position.x ), new Keyframe( 0.5f, targetPos.x ) );
AnimationCurve curveY = new AnimationCurve( new Keyframe( 0, star.transform.position.y ), new Keyframe( 0.5f, targetPos.y ) );
curveY.AddKey( 0.2f, star.transform.position.y - 1 );
float startTime = Time.time;
Vector3 startPos = chicken.transform.position;
Vector3 startPos = star.transform.position;
float distCovered = 0;
while( distCovered < 0.6f )
{
distCovered = ( Time.time - startTime );
chicken.transform.position = new Vector3( curveX.Evaluate( distCovered ), curveY.Evaluate( distCovered ), 0 );
chicken.transform.Rotate( Vector3.back * 10 );
star.transform.position = new Vector3( curveX.Evaluate( distCovered ), curveY.Evaluate( distCovered ), 0 );
star.transform.Rotate( Vector3.back * 10 );
yield return new WaitForEndOfFrame();
}
Destroy( chicken );
Destroy( star );
}
}

Expand Down Expand Up @@ -613,8 +613,8 @@ public void destroy( ArrayList b)
obj.GetComponent<ball>().StartFall();
}
}
// if this is a rounded level, check if the "chicken" (star) is free
CheckFreeChicken();
// if this is a rounded level, check if the "star" (star) is free
CheckFreeStar();
}

// this gets called when the "new sign" button is pressed
Expand Down Expand Up @@ -644,11 +644,11 @@ public void destroyAllballs()
{
foreach( Transform item in Balls )
{
if( item.tag != "chicken" )
if( item.tag != "star" )
{
destroy( item.gameObject );
}
}
CheckFreeChicken();
CheckFreeStar();
}
}
16 changes: 8 additions & 8 deletions Assets/PopSignMain/Scripts/Editor/LevelEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ void GUIBlocks()
{
if (GUILayout.Button(ballTex[i - 1], new GUILayoutOption[] { GUILayout.Width(50), GUILayout.Height(50) }))
{
if ((BallColor)i != BallColor.chicken)
if ((BallColor)i != BallColor.star)
brush = (BallColor)i;
else
{
target = Target.Chicken;
levelSquares[5 * maxCols + 5] = BallColor.chicken;
target = Target.Star;
levelSquares[5 * maxCols + 5] = BallColor.star;
SaveLevel();
}
}
Expand Down Expand Up @@ -440,7 +440,7 @@ void GUIGameField()
{
imageButton = ballTex[5];
}
else if (levelSquares[row * maxCols + col] == BallColor.chicken)
else if (levelSquares[row * maxCols + col] == BallColor.star)
{
imageButton = ballTex[6];
}
Expand Down Expand Up @@ -470,14 +470,14 @@ void GUIGameField()

void SetType(int col, int row)
{
bool chickenExist = false;
bool starExist = false;
levelSquares[row * maxCols + col] = brush;
foreach (BallColor item in levelSquares)
{
if (item == BallColor.chicken)
chickenExist = true;
if (item == BallColor.star)
starExist = true;
}
if (chickenExist) target = Target.Chicken;
if (starExist) target = Target.Star;
else target = Target.Top;
SaveLevel();
// GetSquare(col, row).type = (int) squareType;
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TagManager:
- pink
- violet
- brown
- chicken
- star
- gray
- Pot
- Ball
Expand Down

0 comments on commit d74a0be

Please sign in to comment.