public IEnumerator FlashScreen()
 {
     yield return new WaitForSeconds(FlashAt);
     Instantiate(FlashPrefab);
     yield return new WaitForSeconds(0);
     sound = SoundKit.instance.playSoundLooped(RedTheme);
 }
        private void OnTapped(object sender, EventArgs eventArgs)
        {
            if (Stopped)
                return;

            MarkAsSuccess();
            laserSound = SoundKit.instance.playSound(BlasterShot);
        }
        private void StartHold()
        {
            Holding = true;

            if (PressStarted != null)
                PressStarted();
            CoffeeMaker = SoundKit.instance.playPitchedSound(CoffeeMake, StartInfo.SpeedFactor);
        }
        protected override void OnUnityStart()
        {
            flickGesture = TapArea.GetComponent<FlickGesture>();

            flickGesture.Flicked += OnFlicked;

            HairDryer = SoundKit.instance.playSound(HairDry);
        }         
Пример #5
0
        private void OnFlicked(object sender, EventArgs eventArgs)
        {
            if (Stopped)
                return;

            FingerSwipe = SoundKit.instance.playSound(ScreenSwipe);

            MarkAsSuccess();
        }
        public void Start()
        {
            StartCoroutine(FlashScreen());
            Screen.orientation = ScreenOrientation.Landscape;
            sound = SoundKit.instance.playSound(PowerGuit);

            aSync = SceneManager.LoadSceneAsync(k.Scenes.DEFAULT);
            aSync.allowSceneActivation = false;
            Go.Tapped += (o, e) => StartGame();
            CreditsButton.Tapped += (o, e) => Credits();
            QuitButton.Tapped += (o, e) => Quit();
        }
        protected override void OnMinigameFailed(Action finished)
        {
            this.finished = finished;

            if (Fail)
            {
                Init();
                failSuccessContainer.transform.FindChild("FailedMinigameBasic").gameObject.SetActive(true);
            }
            
            soundPlaying = SoundKit.instance.playPitchedSound(LoseGame, GameFlowController.Current.CurrentSpeed);

            StartCoroutine(StopAfterTime());
        }
        private void Tapped(object sender, EventArgs eventArgs)
        {
            if (Stopped)
                return;

            if (Vector3.Distance(Player.position, Target.position) <= OKDistance)
            {
                MarkAsSuccess();
                Player.gameObject.GetComponent<SpriteRenderer>().sprite = photobombImage;
                Player.gameObject.GetComponent<SpriteRenderer>().flipX = false;
                Player.localScale = new Vector3(1.0f, 1.0f);
                Player.position += new Vector3(-1.0f, 0.0f);
                Instantiate(flashPrefab);
                Shutter = SoundKit.instance.playPitchedSound(ShutterClick, StartInfo.SpeedFactor);
            }
        }
        private void Pressed(object sender, EventArgs eventArgs)
        {
            if (Stopped)
                return;

            laserInstance = Instantiate(LaserPrefab) as GameObject;
            laserInstance.transform.SetParent(GunBarrel.transform, false);

            isHeld = true;

            if (CatMeow != null)
                CatMeow.stop();

            CatMeow = SoundKit.instance.playPitchedSound(LionCat, StartInfo.SpeedFactor);


            touchPosition = pressGesture.ActiveTouches[0].Hit.Point;
        }
Пример #10
0
    public void OnGUI()
    {
        if (GUILayout.Button("Play Explosion"))
        {
            SoundKit.instance.playSound(explosion);
        }

        if (GUILayout.Button("Play Explosion via One Shot"))
        {
            SoundKit.instance.playOneShot(explosion);
        }

        GUILayout.Space(20);

        if (GUILayout.Button("Play Fart"))
        {
            SoundKit.instance.playSound(fart);
        }

        if (_loopedFartSound == null)
        {
            if (GUILayout.Button("Play Fart Looped"))
            {
                _loopedFartSound = SoundKit.instance.playSound(fart).setLoop(true);
            }
        }
        else
        {
            if (GUILayout.Button("Stop Looping Fart Sound"))
            {
                _loopedFartSound.stop();
                _loopedFartSound = null;
            }
        }

        if (GUILayout.Button("Play Fart with Completion Handler"))
        {
            SoundKit.instance.playSound(fart)
            .setCompletionHandler(() => Debug.Log("done playing fart"));
        }

        GUILayout.Space(20);

        if (GUILayout.Button("Play Rocket"))
        {
            SoundKit.instance.playSound(rocket);
        }

        if (GUILayout.Button("Play Squish"))
        {
            SoundKit.instance.playSound(squish);
        }

        if (GUILayout.Button("Play Wind Background Audio"))
        {
            SoundKit.instance.playBackgroundMusic(windBGSound, 8f, true);
        }

        if (GUILayout.Button("Stop Background Audio"))
        {
            SoundKit.instance.backgroundSound.stop();
        }

        if (GUILayout.Button("Toggle AudioListener.pause"))
        {
            AudioListener.pause = !AudioListener.pause;
        }


        GUILayout.Label("Sound Effect Volume");

        var oldVolume = _volume;

        _volume = GUILayout.HorizontalSlider(_volume, 0f, 1f);
        if (oldVolume != _volume)
        {
            SoundKit.instance.soundEffectVolume = _volume;
        }


        GUILayout.Space(20);
        if (SoundKit.instance.backgroundSound != null)
        {
            GUILayout.Label("BG Music Volume");

            oldVolume      = _bgMusicVolume;
            _bgMusicVolume = GUILayout.HorizontalSlider(_bgMusicVolume, 0f, 1f);
            if (oldVolume != _bgMusicVolume)
            {
                SoundKit.instance.backgroundSound.audioSource.volume = _bgMusicVolume;
            }
        }
    }
Пример #11
0
    public void OnGUI()
    {
        if( GUILayout.Button( "Play Explosion" ) )
            SoundKit.instance.playSound( explosion );

        if( GUILayout.Button( "Play Explosion via One Shot" ) )
            SoundKit.instance.playOneShot( explosion );

        GUILayout.Space( 20 );

        if( GUILayout.Button( "Play Fart" ) )
            SoundKit.instance.playSound( fart );

        if( _loopedFartSound == null )
        {
            if( GUILayout.Button( "Play Fart Looped" ) )
                _loopedFartSound = SoundKit.instance.playSound( fart ).setLoop( true );
        }
        else
        {
            if( GUILayout.Button( "Stop Looping Fart Sound" ) )
            {
                _loopedFartSound.stop();
                _loopedFartSound = null;
            }
        }

        if( GUILayout.Button( "Play Fart with Completion Handler" ) )
        {
            SoundKit.instance.playSound( fart )
                .setCompletionHandler( () => Debug.Log( "done playing fart" ) );
        }

        GUILayout.Space( 20 );

        if( GUILayout.Button( "Play Rocket" ) )
            SoundKit.instance.playSound( rocket );

        if( GUILayout.Button( "Play Squish" ) )
            SoundKit.instance.playSound( squish );

        if( GUILayout.Button( "Play Wind Background Audio" ) )
            SoundKit.instance.playBackgroundMusic( windBGSound, 8f, true );

        if( GUILayout.Button( "Stop Background Audio" ) )
            SoundKit.instance.backgroundSound.stop();

        if( GUILayout.Button( "Toggle AudioListener.pause" ) )
            AudioListener.pause = !AudioListener.pause;

        GUILayout.Label( "Sound Effect Volume" );

        var oldVolume = _volume;
        _volume = GUILayout.HorizontalSlider( _volume, 0f, 1f );
        if( oldVolume != _volume )
            SoundKit.instance.soundEffectVolume = _volume;

        GUILayout.Space( 20 );
        if( SoundKit.instance.backgroundSound != null )
        {
            GUILayout.Label( "BG Music Volume" );

            oldVolume = _bgMusicVolume;
            _bgMusicVolume = GUILayout.HorizontalSlider( _bgMusicVolume, 0f, 1f );
            if( oldVolume != _bgMusicVolume )
                SoundKit.instance.backgroundSound.audioSource.volume = _bgMusicVolume;
        }
    }
 protected override void OnMinigameFailed(Action finished)
 {
     this.finished = finished;
     soundPlaying = SoundKit.instance.playPitchedSound(LoseGame, GameFlowController.Current.CurrentSpeed);
     StartCoroutine(StopAfterTime());
 }
Пример #13
0
    void Update()
    {
        if (_controller.isGrounded)
        {
            _velocity.y = 0;
        }

        if (Input.GetButton(_buttons[Button.RIGHT]))
        {
            normalizedHorizontalSpeed = 1;
            if (transform.localScale.x < 0f)
            {
                transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            }

            if (_controller.isGrounded)
            {
                _animator.Play(Animator.StringToHash("Run"));
            }
            if (!runs)
            {
                SoundK = SoundKit.instance.playSoundLooped(run);
                runs   = true;
            }
        }
        else if (Input.GetButton(_buttons[Button.LEFT]))
        {
            normalizedHorizontalSpeed = -1;
            if (transform.localScale.x > 0f)
            {
                transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            }

            if (_controller.isGrounded)
            {
                _animator.Play(Animator.StringToHash("Run"));
            }
            if (!runs)
            {
                SoundK = SoundKit.instance.playSoundLooped(run);
                runs   = true;
            }
        }
        else
        {
            normalizedHorizontalSpeed = 0;

            if (_controller.isGrounded)
            {
                _animator.Play(Animator.StringToHash("Idle"));
            }
            if (runs)
            {
                runs = false;
                SoundK.stop();
            }
        }

        // move pickupObject
        if (isHolding)
        {
            pickedUpObject.transform.position = new Vector3(transform.position.x + (transform.localScale.x / 2), transform.position.y + 1, transform.position.z);;
        }

        // we can only jump whilst grounded
        if (_controller.isGrounded && Input.GetButtonDown(_buttons[Button.A]))
        {
            _velocity.y = Mathf.Sqrt(2f * jumpHeight * -gravity);
            _animator.Play(Animator.StringToHash("Jump"));
            SoundKit.instance.playOneShot(jump);
        }


        // apply horizontal speed smoothing it. dont really do this with Lerp. Use SmoothDamp or something that provides more control
        var smoothedMovementFactor = _controller.isGrounded ? groundDamping : inAirDamping;         // how fast do we change direction?

        _velocity.x = Mathf.Lerp(_velocity.x, normalizedHorizontalSpeed * runSpeed, Time.deltaTime * smoothedMovementFactor);

        // apply gravity before moving
        _velocity.y += gravity * Time.deltaTime;

        // if holding down bump up our movement amount and turn off one way platform detection for a frame.
        // this lets us jump down through one way platforms
        if (_controller.isGrounded && Input.GetButton(_buttons[Button.DOWN]))
        {
            _velocity.y *= 3f;
            _controller.ignoreOneWayPlatformsThisFrame = true;
        }

        _controller.move(_velocity * Time.deltaTime);

        // grab our current _velocity to use as a base for all calculations
        _velocity = _controller.velocity;

        if (Input.GetButtonDown(_buttons[Button.B]))
        {
            //TODO: b-button stuff!
            Debug.Log(_buttons[Button.B]);

            if (isHolding)
            {
                // if holding Throwable => Throw
                // calc force
                Vector2 force = new Vector2(transform.localScale.x * throwForce.x, throwForce.y);
                isHolding = false;
                pickedUpObject.Throw(force);
                pickedUpObject = null;
            }
            else
            {
                // if near Throwable => Pick up
                if (pickedUpObject != null)
                {
                    pickedUpObject.StartHolding();
                    isHolding = true;
                    // else => Punch
                }
                else
                {
                    // punch
                }
            }
        }
    }
        private void SpawnLaser(Vector3 startPosition)
        {
            startLaserPosition = startPosition;
            touchPosition = startLaserPosition;
            laserInstance = Instantiate(LaserPrefab);
            laserInstance.transform.SetParent(LaserParent, false);
            laserSound = SoundKit.instance.playPitchedSound(BlasterHeld, StartInfo.SpeedFactor);

            Camera.main.GetComponent<ScreenShake>().ShakeCamera(0.5f, TimeSpan.MaxValue);
        }