public void ClickStart() { // myMachineState = AllMachines.MachineState.full; if (myMachineState == AllMachines.MachineState.full) { myMachineState = AllMachines.MachineState.washing; Light.sprite = statusWashing; } }
public IEnumerator CollectClothese() { emptyImage.enabled = true; fullImage.enabled = false; yield return(new WaitForSeconds(ValueEditor.TimeRelated.openWasherDelay2)); DoorImage.sprite = AllMachines.closedDoor; Light.sprite = statusEmpty; myMachineState = AllMachines.MachineState.empty; }
public void ClickStart() { if (myMachineState == AllMachines.MachineState.full) { myMachineState = AllMachines.MachineState.washing; //for tutorial if (FinalCameraController.isTutorial) { FinalCameraController.TutorialManager.tutorialNumber = 6; } } }
public IEnumerator DropClothes() { myMachineState = AllMachines.MachineState.full; DoorImage.sprite = AllMachines.openedDoor; yield return(new WaitForSeconds(ValueEditor.TimeRelated.openWasherDelay1)); emptyImage.enabled = false; fullImage.enabled = true; yield return(new WaitForSeconds(ValueEditor.TimeRelated.openWasherDelay2)); DoorImage.sprite = AllMachines.closedDoor; }
// Start is called before the first frame update void Start() { clothNum = buttons.Length; myMachineState = AllMachines.MachineState.empty; myAnimator = GetComponentInChildren <Animator>(); FinalCameraController = GameObject.Find("Main Camera").GetComponent <FinalCameraController>(); CalculateInventory = GameObject.Find("---InventoryController").GetComponent <CalculateInventory>(); washingSound = AllMachines.gameObject.GetComponent <AudioSource>(); Hide(Occupied); }
// Start is called before the first frame update void Start() { clothNum = buttons.Length; myMachineState = AllMachines.MachineState.empty; myAnimator = GetComponentInChildren <Animator>(); FinalCameraController = GameObject.Find("Main Camera").GetComponent <FinalCameraController>(); SpriteLoader = GameObject.Find("---SpriteLoader").GetComponent <SpriteLoader>(); AudioManager = GameObject.Find("---AudioManager").GetComponent <AudioManager>(); SubwayMovement = GameObject.Find("---StationController").GetComponent <SubwayMovement>(); ValueEditor = GameObject.Find("---ValueEditor").GetComponent <ValueEditor>(); washingSound = AllMachines.gameObject.GetComponent <AudioSource>(); TouchController = GameObject.Find("---TouchController").GetComponent <TouchController>(); emptyImage = empty.GetComponent <SpriteRenderer>(); fullImage = full.GetComponent <SpriteRenderer>(); DoorImage = front.GetComponent <SpriteRenderer>(); Light.sprite = statusEmpty; }
// Update is called once per frame void Update() { if (!SubwayMovement.pauseBeforeMove) { realTimer = AllMachines.washTime - timer; } UpdateProgressBar(); //close all ui if swipping the screen if (FinalCameraController.isSwipping && !FinalCameraController.isTutorial) { //@@@ //Destroy(FinalCameraController.generatedNotice); FinalCameraController.alreadyNotice = false; } if (myMachineState == AllMachines.MachineState.finished) { //todo: 滑动关闭ClothUI & cloth buttons // if(clothNum > 0) // { // emptyImage.enabled = false; // fullImage.enabled = true; // } // else if (clothNum == 0) // { // emptyImage.enabled = true; // fullImage.enabled = false; // } } //if click a bag of cloth, put them into the machine and start washing if (myMachineState == AllMachines.MachineState.washing) { myAnimator.SetBool("isWashing", true); //lightAnimator.SetBool("isWashing", true); //lightAnimator.SetBool("Reset",false); emptyImage.enabled = false; timer += Time.deltaTime; if (timer > AllMachines.washTime) { //Debug.Log("this machine finished!"); AudioManager.PlayAudio(AudioType.Machine_Finished); myMachineState = AllMachines.MachineState.finished; //本来在这里 generatecloth //finish myAnimator.SetBool("isWashing", false); Occupied.SetActive(true); //timer = 0; //when the bag returned set the timer 0 and change image Light.sprite = statusFinished; UpdateProgressBar(); } } //@@@ // handle click if (TouchController.myInputState == TouchController.InputState.Tap) { if (TouchController.RaycastHitResult[0] == "washer" && TouchController.RaycastHitResult[1] == number.ToString()) { clickMachineNewMethod(); } } }
// Update is called once per frame void Update() { realTimer = AllMachines.washTime - timer; if (Mathf.RoundToInt(timer / 60) < 10) { if (Mathf.RoundToInt(realTimer % 60) < 10) { timerNum.text = "0" + Mathf.RoundToInt(realTimer / 60).ToString() + ":" + "0" + Mathf.RoundToInt(realTimer % 60).ToString(); } else { timerNum.text = "0" + Mathf.RoundToInt(realTimer / 60).ToString() + ":" + Mathf.RoundToInt(realTimer % 60).ToString(); } } else { if (Mathf.RoundToInt(realTimer % 60) < 10) { timerNum.text = Mathf.RoundToInt(realTimer / 60).ToString() + ":" + "0" + Mathf.RoundToInt(realTimer % 60).ToString(); } else { timerNum.text = Mathf.RoundToInt(realTimer / 60).ToString() + ":" + Mathf.RoundToInt(realTimer % 60).ToString(); } } //close all ui if swipping the screen if (FinalCameraController.isSwipping && !FinalCameraController.isTutorial) { Destroy(FinalCameraController.generatedNotice); FinalCameraController.alreadyNotice = false; // FinalCameraController.alreadyClothUI = false; // //hide all cloth ui // Hide(backgroundUI3); // Hide(backgroundUI2); // Hide(backgroundUI); // // Show(Occupied); // Hide(ClothUI); // DoorImage.sprite = AllMachines.closedDoor; } if (myMachineState == AllMachines.MachineState.empty) { fullImage.enabled = false; emptyImage.enabled = true; DoorImage.sprite = AllMachines.closedDoor; Hide(Occupied); } else if (myMachineState == AllMachines.MachineState.full) { if (clothNum > 0) { emptyImage.enabled = false; fullImage.enabled = true; } else if (!FinalCameraController.isTutorial) { // StartCoroutine(MachineFold()); } } else if (myMachineState == AllMachines.MachineState.finished) { //每次滑动的时候都把洗衣机的ui关掉 //这样可能会导致刚滑到某个页面的时候点了洗衣机,只出现衣服ui而不出现clothUI // if (FinalCameraController.mySubwayState == FinalCameraController.SubwayState.None && !FinalCameraController.isTutorial) // { // // pressOK = false; // Hide(backgroundUI3); // Hide(backgroundUI2); // Hide(backgroundUI); // // Show(Occupied); // Hide(ClothUI); // DoorImage.sprite = AllMachines.closedDoor; // } //下面这段有相同问题 if (!FinalCameraController.isTutorial) { if (FinalCameraController.mySubwayState == FinalCameraController.SubwayState.Two) { if (number != 1) { Hide(backgroundUI3); Hide(backgroundUI2); Hide(backgroundUI); Show(Occupied); Hide(ClothUI); DoorImage.sprite = AllMachines.closedDoor; } } else if (FinalCameraController.mySubwayState == FinalCameraController.SubwayState.Three) { if (number == 1) { Hide(backgroundUI3); Hide(backgroundUI2); Hide(backgroundUI); Show(Occupied); Hide(ClothUI); DoorImage.sprite = AllMachines.closedDoor; } } } if (clothNum > 0) { emptyImage.enabled = false; fullImage.enabled = true; } else if (clothNum == 0) { //close door if there is no cloth in machine //拿完了之后应该直接关掉,但如果玩家点了,还是应该打开 //现在写在doInventory每次拿完衣服之后了 // if (shut == 1 && CalculateInventory.InventoryFull) // { // shut = 0; // Hide(ClothUI); // StartCoroutine(MachineFold()); // //ClothUiAnimator.SetBool("isUnfold",false); // DoorImage.sprite = AllMachines.closedDoor; // } emptyImage.enabled = true; fullImage.enabled = false; } } //if click a bag of cloth, put them into the machine and start washing else if (myMachineState == AllMachines.MachineState.washing) { myAnimator.SetBool("isWashing", true); lightAnimator.SetBool("isWashing", true); emptyImage.enabled = false; timer += Time.deltaTime; if (timer > AllMachines.washTime) { myMachineState = AllMachines.MachineState.finished; myAnimator.SetBool("isWashing", false); lightAnimator.SetBool("isWashing", false); washingSound.Stop(); Show(Occupied); timer = 0; //for tutorial,衣服洗完了 if (FinalCameraController.isTutorial) { FinalCameraController.TutorialManager.tutorialNumber = 8; } } } // // //any touch cancels cloth UI // else if(TouchController.myInputState != TouchController.InputState.None) // { // if (shut == 1) // { // shut = 0; // //subway.transform.position += offsetTap; // Hide(ClothUI); // //backgroundSR.enabled = false; // } // } }