Esempio n. 1
0
    void CheckControls()
    {
        #region Platform Control
        #region Creation/Deletion
        if (Input.GetKeyDown(KeyCode.RightAlt))
        {
            _platformSpawner.SpawnPlatform(-2);
        }

        if (Input.GetKeyDown(KeyCode.RightControl))
        {
            _platformSpawner.DeleteFirst();
        }
        #endregion

        #region Arrow Keys
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            //PlatformSizer sizer = _platformSpawner.FirstQueue().GetComponent<PlatformSizer>();

            _platformSpawner.Shift(-1, 0);

            //sizer.Shift(-1, 0);
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            //PlatformSizer sizer = _platformSpawner.FirstQueue().GetComponent<PlatformSizer>();

            _platformSpawner.Shift(1, 0);
            //sizer.Shift(1, 0);
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            //PlatformSizer sizer = _platformSpawner.FirstQueue().GetComponent<PlatformSizer>();

            _platformSpawner.Shift(0, -1);
            //sizer.Shift(0, -1);
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            //PlatformSizer sizer = _platformSpawner.FirstQueue().GetComponent<PlatformSizer>();

            _platformSpawner.Shift(0, 1);
            //sizer.Shift(0, 1);
        }
        #endregion
        #endregion

        #region Mouse
        if (Input.GetMouseButtonDown(1))
        {
            Vector2 mouseClickPosition = Input.mousePosition;

            //shootController.DebugDrawLine(player.position, mouseClickPosition);
            //shootController.DrawRaycast();
        }
        if (Input.GetMouseButton(1))
        {
            if (!powerUpSound.isPlaying)
            {
                powerUpSound.Play();
            }
            jumpPower += Time.deltaTime;
            jumpPower  = Mathf.Min(jumpPower, maxJumpPower);

            powerUpSound.pitch = jumpPower;
        }
        if (Input.GetMouseButtonUp(1))
        {
            powerUpSound.Stop();
            shootController.Jump(jumpPower);
            jumpPower = 0f;
        }

        if (Input.GetMouseButtonDown(0))
        {
            shootController.ShootBullet();
        }
        #endregion

        if (Input.GetKeyDown(KeyCode.P))
        {
            healthController.TakeDamage(10);
        }
    }