/*Method: StopAtNextWayPoint() * Parameters: GameObject * Returns: void * Class Scope Effects: Avatar.onTarget, current_waypoint_num * Called Methods: Game.CheckGameState(); * * Description: Stops the animation of avatar * * Version/Date: <Version#1 / 04-18> */ static public void StopAtNextWayPoint(GameObject avatar) { //print("1 | stop at next way-point"); //debugging report of positions //print("AVA | x: " + avatar.transform.position.x + ", " + "y: " + target_waypoint.transform.position.y); //print("NEXT | x: " + target_waypoint.transform.position.x + ", " + " y: " + target_waypoint.transform.position.y); //Check if animated avatar is within range of center point of target_waypoint if (Mathf.Abs(avatar.transform.position.x - target_waypoint.transform.position.x) < 10 && Mathf.Abs(avatar.transform.position.y - target_waypoint.transform.position.y) < 10) { //print("2 | stop at next way-point"); //Set velocity to zero avatar.GetComponent <Rigidbody2D>().velocity = Vector2.zero; //Changes onTarget Avatar.onTarget = true; //passes target to current_waypoint current_waypoint_num = target_waypoint_num; //plays challenge that is on waypoint ChallengeDeck.currChallenge_num = target_waypoint_num; //post next event ChallengeDeck.PostNewChallenge(); Dice.rollDice_btn.interactable = true; Dice.are_dice_on = true; } //Runs helper method Game.CheckGameState(); }
/* Method: Replay() * Parameters: None * Returns: Void * Class Scope Effects: current_state, currState_txt.text * Called Methods: Dice.Replay(), Player.Replay(), Path.Replay(), ChallengeDeck.Replay() * * Description: Resets Game field variables to the start state * * Version/Date: <Ver#1 / 04-25> */ public void Replay() { //Reports game state current_state = State.start; //Sends game state to game interface; currState_txt.text = current_state.ToString(); //Buttons reactivated human_btn.interactable = true; dog_btn.interactable = true; Dice.Replay(); Path.Replay(); ChallengeDeck.Replay(); }