public void ToggleSpeed(bool?enableSpeedBoost = null) { if (Level != 2) { return; } const int speedBoost = 1; DizzyEffect.StartDoingTheDizzy(); var playerController = pacman.GetComponent <PlayerController>(); if ((enableSpeedBoost.HasValue && enableSpeedBoost.Value == false) || !enableSpeedBoost.HasValue && pacmanHasSpeedBoost) { if (pacmanHasSpeedBoost) { playerController.speed = playerController.speed -= speedBoost; } pacmanHasSpeedBoost = false; MoveInvertEffect.StopDoingTheEffect(); } else { if (!pacmanHasSpeedBoost) { playerController.speed = playerController.speed += speedBoost; } pacmanHasSpeedBoost = true; MoveInvertEffect.StartDoingTheEffect(); } }
void Update() { if (dizzinessGoing) { dizzinnessTimer += Time.deltaTime; Material.SetFloat("_OffsetMultiplier", Heaviness * Mathf.Sin(Mathf.PI * dizzinnessTimer / Duration)); if (dizzinnessTimer > Duration) { dizzinessGoing = false; dizzinnessTimer = 0f; } } if (Input.GetKeyDown(KeyCode.O)) { DizzyEffect.StartDoingTheDizzy(); } }
public void InverseControls(bool?inversionEnabled = null) { DizzyEffect.StartDoingTheDizzy(); var playerController = pacman.GetComponent <PlayerController>(); if (inversionEnabled.HasValue) { playerController._isInversed = inversionEnabled.Value; } else { playerController._isInversed = !playerController._isInversed; } if (playerController._isInversed) { MoveInvertEffect.StartDoingTheEffect(); } else { MoveInvertEffect.StopDoingTheEffect(); } }
override public void Invoke() { DizzyEffect.StartDoingTheDizzy(); }