//A new changing function that either randomizes the player movement, or perfectly matches. public void masterPlayerSpriteChange(int spriteIndex, ARROW_TYPE arrowClassification) { SpriteRenderer temp = playerSprite.GetComponent <SpriteRenderer> (); /*if (arrowClassification == ARROW_TYPE.FRIEND) * { * temp.sprite = playerSpriteSheet [listMark]; * }*/ //If arrow_type is class, it is randomized // GARRAH: What does friendMove indicate? What does this code do? // If friendMove is true, our player moves according to key-press // If friendMove is false, the player's movement is randomized if (arrowClassification == ARROW_TYPE.CLASS && friendMove == false) { int rand = Random.Range(0, 4); while (rand == spriteIndex) { rand = Random.Range(0, 4); } temp.sprite = playerSpriteSheet [rand]; } else if (arrowClassification == ARROW_TYPE.FRIEND) { temp.sprite = playerSpriteSheet [spriteIndex]; friendMove = true; } }
public void setPlayerSpritePose(MGDirectionUtils.MGDirection poseDirection, ARROW_TYPE arrowType) { SpriteRenderer temp = playerSprite.GetComponent <SpriteRenderer>(); /*if (arrowClassification == ARROW_TYPE.FRIEND) * { * temp.sprite = playerSpriteSheet [listMark]; * }*/ //If arrow_type is class, it is randomized // GARRAH: What does friendMove indicate? What does this code do? // If friendMove is true, our player moves according to key-press // If friendMove is false, the player's movement is randomized if (arrowType == ARROW_TYPE.CLASS && friendMove == false) { int rand = Random.Range(0, 4); while (rand == ConvertDirectionToSpriteIndex(poseDirection)) { rand = Random.Range(0, 4); } temp.sprite = playerSpriteSheet[rand]; } else if (arrowType == ARROW_TYPE.FRIEND) { temp.sprite = playerSpriteSheet[ConvertDirectionToSpriteIndex(poseDirection)]; friendMove = true; } }
public void ChangeCharacterPose(MGDirectionUtils.MGDirection poseDirection, ARROW_TYPE arrowType) { if (arrowType == ARROW_TYPE.FRIEND) { friendPosePrev = poseDirection; callSprScr.setFriendPose(friendPosePrev); } else if (arrowType == ARROW_TYPE.CLASS) { classPosePrev = poseDirection; callSprScr.setClassPose(classPosePrev); } }
//New score func that checks on the arrow type now public void IncreaseScore(ARROW_TYPE arrowEnum) { if (friendSprOn == false && nameOfLevel == LEVEL_2D_NAMES.STAGE_1) { Score++; //callSprScr.IdleInvoker (); callSprScr.IdleInvoker_Friend(); } else if (friendSprOn == true && nameOfLevel == LEVEL_2D_NAMES.STAGE_1) { if (arrowEnum == ARROW_TYPE.FRIEND) { Score++; //Some lazy code for the arrow to disappear, Sorry Garrah. arrowObj.GetComponent <SpriteRenderer> ().color -= new Color(0, 0, 0, 0.2f); //Due to the fact that this implicitly implies it is stage one, //It calls the particle effect. callSprScr.ActivateParticleEffect(); //Makes it so that the game over timer doesn't tick down. friendHit = true; } //The actual tick down timer. else if (arrowEnum == ARROW_TYPE.CLASS) { if (friendHit == false) { loseScriptCall.LoseCountdownFunction(); } } //callSprScr.IdleInvoker (); callSprScr.IdleInvoker_Friend(); } arrowScr.disableArrow(); if (nameOfLevel == LEVEL_2D_NAMES.STAGE_1) { arrowScrFrd.disableArrow(); } if (nameOfLevel == LEVEL_2D_NAMES.STAGE_2) { Score++; callSprScr.IdleInvoker(); } }