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"); }
public override void Init() { base.Init(); SoundManager.instance.Add(GetComponent <AudioSource>()); ui = GuiManager.instance.InstantiateUISituation(); ui.Show(false, false, true); ui.SetMain(icon); ui.SetMask(icon); ui.target = transform; //ui.SetOffset(new Vector3(0, 3, 0)); StartCoroutine(CTWaitTime(maxWaitTime)); StartCoroutine(CTHaloAnim()); }
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(); }