IEnumerator BreakCar() { int time = Random.Range(3, 6); yield return(new WaitForSeconds(time)); breakOn = true; speed = 0; brokenButton = GuiManager.instance.InstantiateUIButton(); brokenButton.SetOnClick(UnbreakCar); brokenButton.SetOffset(new Vector3(0, 24, 0)); // brokenButton.SetOffset(new Vector3(0, 128, 0)); brokenButton.SetImage(breakSprite); brokenButton.ShowText(false); brokenButton.target = transform; isBroken = true; firePart = GameObject.Instantiate(particleFire, transform.position, Quaternion.identity); if (!brokenMessage) { brokenMessage = true; brokenInstruction = GuiManager.instance.InstantiateUIInstructionEmpty(); brokenInstruction.SetText("TAP TO FIX CAR"); brokenInstruction.Show(false, false, true); brokenInstruction.target = transform; brokenInstruction.SetOffset(new Vector3(0, 172, 0)); GameManager.instance.ManageTime(0); yield return(new WaitForSecondsRealtime(5)); GameManager.instance.ManageTime(1); } Debug.Log("eNTRO A ROMPERESE"); }
IEnumerator CTWaitTime(float waitTime) { float wt = waitTime; float maxWt = waitTime; while (wt > 0) { wt -= Time.deltaTime; ui.SetFill(wt / maxWt); ui.SetText(wt.ToString("n1")); yield return(new WaitForEndOfFrame()); } GuiManager.instance.ChangeEndGameText(carType + " DIDNT ARRIVED ON TIME!!!"); GameManager.instance.OnCarCollision(); }
IEnumerator CTInstruction() { taxiFirstTime = true; //decir que toque el boton taxiInstruction = GuiManager.instance.InstantiateUIInstructionEmpty(); taxiInstruction.SetText("TAP TO LEAVE STOP"); taxiInstruction.Show(false, false, true); taxiInstruction.target = transform; taxiInstruction.offset = new Vector3(0, 172, 0); GameManager.instance.ManageTime(0); yield return(new WaitForSecondsRealtime(5)); CleanCt(); //sacar el boton; }
IEnumerator CTInstruction() { firstTime = true; //decir que toque el boton uiInstruction = GuiManager.instance.InstantiateUIInstructionEmpty(); uiInstruction.SetText("TAP TO CROSS FASTER"); uiInstruction.Show(false, false, true); uiInstruction.target = transform; uiInstruction.offset = new Vector3(0, 8, 0); GameManager.instance.ManageTime(0); yield return(new WaitForSecondsRealtime(5)); GameManager.instance.ManageTime(1); if (uiInstruction != null && uiInstruction.gameObject != null) { Destroy(uiInstruction.gameObject); } //sacar el boton; }
public void OnEndArrive() { if (!rewardSended) { rewardSended = true; float rewardMult = Mathf.Clamp(5 - timeBreak, 0, 5); int r = (int)(reward * rewardMult); UISituation endReward = GuiManager.instance.InstantiateUISituation(); endReward.Show(false, false, true); endReward.SetText("+" + r); endReward.SetOffset(-direction); endReward.SetPos(transform.position + new Vector3(0, 2, 0)); Color col; if (rewardMult <= 1) { col = Color.red; } else if (rewardMult > 1 && rewardMult < 3.5f) { col = Color.yellow; } else { col = Color.green; } endReward.SetTextColor(col); endReward.Anim(); Destroy(endReward.gameObject, 1); GameManager.instance.OnCarPassed(r, carType); } spawner.currentCars.Remove(gameObject); OnDie(); }