/// <summary> /// Called by stage change canvas script after scene change screen has been passed /// </summary> public void SetStage() { //reset cash pile //cashController.ClearCash(); //get targer position queue for new stage stagePositions = WhenPigsFlyLevelInitializer.GetLevelPointsQueue(_GlobalVariables.difficulty, stage); //reset coin to beginning position of the queue target.transform.position = ConvertToTruePoint(stagePositions.Dequeue()); //set the next targer for lerping SetNewTarget(); }
/// <summary> /// Used to initialize values such as viewport size and set the first target /// </summary> void Start() { //WhenPigsFlySmartFeedbackProcessor.ResetVars(); //signal that the main thread is active to prevent shutdown of arduino communication thread _GlobalVariables.mainThreadActive = true; //get camera dimensions float camHeight = Camera.main.orthographicSize; float camWidth = Camera.main.aspect * camHeight; viewport = new Vector2(camWidth, camHeight); sessionDate = DateTime.Now; //initializes levels WhenPigsFlyLevelInitializer.WriteLevelsToJSON(); //initialize stage related variables stage = 0; SetStage(); audioSrc = GetComponent <AudioSource>(); previousCoinPos = target.transform.position; }