// Update is called once per frame void Update() { if (GameManager.instance.isPaused && !SceneManagement.GetCurrentScene().Equals(GameInformation.tutorial2)) { return; } if (currentCharge < maxCharge) { ChargeMP(passiveChargeAmount * Time.deltaTime); } if (Input.GetButtonDown("NextSpell")) { SetNextSpell(1); } else if (Input.GetButtonDown("PrevSpell")) { SetNextSpell(-1); } if (!m_innerWitch.GetComponent <PlayerController>().ReadyToSwitch() && !m_outerWitch.GetComponent <PlayerController>().ReadyToSwitch() && m_innerWitch.GetComponent <SpriteRenderer>().color == Color.magenta) { m_innerWitch.GetComponent <SpriteRenderer>().color = Color.white; m_outerWitch.GetComponent <SpriteRenderer>().color = Color.white; } if (m_innerWitch.GetComponent <PlayerController>().ReadyToSwitch() && m_outerWitch.GetComponent <PlayerController>().ReadyToSwitch()) { if (switchSlider.GetComponent <SwitchSlider>().PerfectSwitch()) { StartCoroutine(PerfSwitch()); } Time.timeScale = 1f; Switch(); m_innerWitch.GetComponent <PlayerController>().Unready(); m_outerWitch.GetComponent <PlayerController>().Unready(); timeBetweenSwitch = 0.0f; switchSlider.SetActive(false); } else if (m_innerWitch.GetComponent <PlayerController>().ReadyToSwitch() || m_outerWitch.GetComponent <PlayerController>().ReadyToSwitch()) { m_innerWitch.GetComponent <SpriteRenderer>().color = Color.magenta; m_outerWitch.GetComponent <SpriteRenderer>().color = Color.magenta; StartCoroutine(PerfSwitchTimer()); Time.timeScale = .1f; switchSlider.SetActive(true); } else if (!m_innerWitch.GetComponent <PlayerController>().ReadyToSwitch() && !m_outerWitch.GetComponent <PlayerController>().ReadyToSwitch() && !GameManager.instance.isPaused) { Time.timeScale = 1f; switchSlider.SetActive(false); } else if (currentCharge < maxCharge) { m_innerWitch.GetComponent <SpriteRenderer>().color = Color.white; m_outerWitch.GetComponent <SpriteRenderer>().color = Color.white; } if (m_innerWitch.GetComponent <PlayerController>().ReadyToAttack() && m_outerWitch.GetComponent <PlayerController>().ReadyToAttack() && currentCharge >= currentSpellCost) { m_innerWitch.GetComponent <SpriteRenderer>().color = Color.white; m_outerWitch.GetComponent <SpriteRenderer>().color = Color.white; if (!MPSlider) { return; } Instantiate(currentSpell, transform); currentCharge -= currentSpellCost; } else if ((m_innerWitch.GetComponent <PlayerController>().ReadyToAttack() || m_outerWitch.GetComponent <PlayerController>().ReadyToAttack()) && currentCharge >= currentSpellCost && MPSlider != null) { if (!flashing) { StartCoroutine(UltFlash()); } flashing = true; } else if (currentCharge >= currentSpellCost && !flashing && MPSlider) { m_innerWitch.GetComponent <SpriteRenderer>().color = Color.cyan; m_outerWitch.GetComponent <SpriteRenderer>().color = Color.cyan; } //if (m_innerWitch.GetComponent<PlayerController>().ReadyToWave() //&& currentCharge >= wave.GetComponent<Spell>().MPCost()) //{ // Instantiate(wave, transform); // currentCharge -= wave.GetComponent<Spell>().MPCost(); //} if (mpAmount != null) { mpAmount.text = Mathf.RoundToInt(currentCharge).ToString(); } }