コード例 #1
0
    /**
     * Handles aiming, shooting, and projectileType selection
     */
    void Update()
    {
        arm.right = Input.mousePosition - mainCamera.halfScreenSize;

        if (Input.GetKeyUp(inputConfig.firePrimaryProjectile) && recoiling == false)
        {
            if (projectileSound != null && audioSource != null)
            {
                audioSource.Play();
            }

            recoiling = true;
            projectilePool.ActivateProjectile(gunMuzzle.position, arm.right);
            StartCoroutine(Recoil());
        }

        if (Input.GetKeyUp(inputConfig.toggleLaser))
        {
            projectileType += 1;

            if (projectileType == ProjectileType.Length)
            {
                projectileType = 0;
            }

            hud.SetLaserDisplay(projectilePool.projectiles[0].GetColour(projectileType));
            hud.SetCurrentLaserText(projectileType);
        }
    }