コード例 #1
0
ファイル: GameManager.cs プロジェクト: GamebasicsBV/Pacman
    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();
        }
    }
コード例 #2
0
ファイル: DizzyEffect.cs プロジェクト: GamebasicsBV/Pacman
    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();
        }
    }
コード例 #3
0
ファイル: GameManager.cs プロジェクト: GamebasicsBV/Pacman
    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();
        }
    }
コード例 #4
0
ファイル: DizzyEffect.cs プロジェクト: GamebasicsBV/Pacman
 private void Start()
 {
     instance = this;
 }
コード例 #5
0
 override public void Invoke()
 {
     DizzyEffect.StartDoingTheDizzy();
 }