public void MagicSlowHit() { if (magicHitCount == 0) // maximum 2 stack on magic slow { speed -= 0.7f; slowState = SlowState.OneSlow; } else if (magicHitCount == 1) { speed -= 0.4f; slowState = SlowState.TwoSlow; } magicHitCount++; }
public void MagicSlowRelease() { if (magicHitCount == 1) { speed += 0.7f; slowState = SlowState.Normal; } else if (magicHitCount == 2) { speed += 0.4f; slowState = SlowState.OneSlow; } magicHitCount--; }
// Update is called once per frame void Update() { ScrollPoint += InputController.Instance.Scroll.delta * 0.5f; if (ScrollPoint < 0f) { ScrollPoint = 2.99f; } else if (ScrollPoint > 2.99f) { ScrollPoint = 0f; } if (Input.GetKeyDown("1")) { ScrollPoint = 0; } else if (Input.GetKeyDown("2")) { ScrollPoint = 1; } else if (Input.GetKeyDown("3")) { ScrollPoint = 2; } int roundedSelect = (int)Mathf.Floor(ScrollPoint); if (roundedSelect != oldSelect) { oldSelect = roundedSelect; switch (roundedSelect) { case 0: HighlightImage.rectTransform.localPosition = new Vector3(-32f, 0f); break; case 1: HighlightImage.rectTransform.localPosition = new Vector3(0f, 0f); break; case 2: HighlightImage.rectTransform.localPosition = new Vector3(32f, 0f); break; } Player.SetCurrentAbility(_abilitiesT[roundedSelect]); } //Slow switch (slowstate) { case SlowState.Ready: if (InputController.Instance.Wheel.Down) { SlowImage.enabled = true; Time.timeScale = slowFactor; slowstate = SlowState.Active; } break; case SlowState.Active: curSlowTimer -= Time.deltaTime; slowSlider.value = curSlowTimer; if (InputController.Instance.Wheel.Up || curSlowTimer < 0f) { SlowImage.enabled = false; Time.timeScale = 1f; sliderFill.color = Color.red; slowstate = SlowState.Charge; } break; case SlowState.Charge: curSlowTimer += Time.deltaTime; slowSlider.value = curSlowTimer; if (curSlowTimer > slowTimer) { curSlowTimer = slowTimer; sliderFill.color = Color.green; slowstate = SlowState.Ready; } break; } foreach (Ability ability in _abilitiesT) { ability.GroundCheck(_playerController); } }