예제 #1
0
파일: Box.cs 프로젝트: bitowl/ld42
 // Use this for initialization
 void Start()
 {
     NameText.text          = Variable.Name;
     throwingEffectEmission = ThrowingEffect.emission;
     BoxSpawnSound.Play(BoxAudioSource);
     hitSoundCooldown = 1;
 }
예제 #2
0
        void Button3Click(object sender, EventArgs e)
        {
            MediaFile mediaFile = new SoundFile("resources\\track.wma");

            mediaFile.Play();
            System.Threading.Thread.Sleep(3000);
            mediaFile.Stop();
        }
예제 #3
0
파일: Box.cs 프로젝트: bitowl/ld42
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag != "Player")
     {
         ThrowingEffect.Stop();
         if (hitSoundCooldown < 0)
         {
             BoxHitSound.Play(BoxAudioSource);
             hitSoundCooldown = .1f;
         }
     }
 }
예제 #4
0
        private void PlayWarningSound()
        {
            String soundFile = Properties.Settings.Default.Sound4CompletingBreak;

            if (soundFile != "")
            {
                try {
                    SoundFile sound = new SoundFile(soundFile);
                    sound.Play();
                } catch (Exception ex) {
                    log.Error("Could not play music!", ex);
                }
            }
        }
예제 #5
0
 // Update is called once per frame
 void Update()
 {
     if (Time.timeScale == 0)
     {
         return;
     }
     rotationInput   = Input.GetAxis("Mouse X");
     horizontalInput = Input.GetAxis("Horizontal");
     verticalInput   = Input.GetAxis("Vertical");
     if (Input.GetButtonDown("Jump") && IsGrounded())           // TODO: Check touches ground
     {
         rb.AddForce(transform.up * JumpForce, ForceMode.Impulse);
         JumpSound.Play(BotAudioSource);
     }
 }
예제 #6
0
    private void AttractUsingLerp()
    {
        if (!isAttracting || currentlyPickedUp == null)
        {
            return;
        }

        if (isLerpingPosition)
        {
            // Move this to the correct position
            currentlyPickedUp.transform.position = Vector3.Lerp(currentlyPickedUp.transform.position, ForkLift.position, Time.deltaTime * PickupLerpSpeed);

            // Snap completely if close
            float epsilon = .1f;
            if ((currentlyPickedUp.transform.position - ForkLift.position).sqrMagnitude < epsilon)
            {
                BoxPickupEvent.Raise();
                AttractedInPosition.Play(ForkLiftAudioSource);
                isLerpingPosition = false;
            }
        }
        else
        {
            currentlyPickedUp.transform.position = ForkLift.position;
        }

        if (isLerpingRotation)
        {
            currentlyPickedUp.transform.rotation = Quaternion.Slerp(currentlyPickedUp.transform.rotation, ForkLift.rotation, Time.deltaTime * PickupLerpSpeed);

            float angleEpsilon = 1f;
            if (Quaternion.Angle(currentlyPickedUp.transform.rotation, ForkLift.rotation) < angleEpsilon)
            {
                isLerpingRotation = false;
            }
        }
        else
        {
            currentlyPickedUp.transform.rotation = ForkLift.rotation;
        }
    }
예제 #7
0
 public void OnInTraciSenseStop()
 {
     InTraciSenseEndSound.Play(BotAudioSource);
 }
예제 #8
0
 public void OnInTraciSenseStart()
 {
     InTraciSenseStartSound.Play(BotAudioSource);
 }
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if (Time.timeScale == 0)
        {
            return;
        }

        input = Input.GetAxis("Mouse Y");

        var fire1AxisTrue = Input.GetAxis("Fire1") > 0;
        var fire1AxisDown = fire1AxisTrue && !fire1AxisTrueLastFrame;
        var fire1AxisUp   = !fire1AxisTrue && fire1AxisTrueLastFrame;

        fire1AxisTrueLastFrame = fire1AxisTrue;

        if (Input.GetButtonDown("Fire1") || fire1AxisDown)
        {
            if (isAttracting)
            {
                if (currentlyPickedUp != null)
                {
                    timeCharged    = 0;
                    isChargingPush = true;
                    FullyChargedEffect.Play();
                    ChargingSound.Play(ForkLiftAudioSource);
                }
                else
                {
                    isAttracting = false;
                }
            }
            else
            {
                SelectGameObjectToPickup();
                if (isAttracting)
                {
                    AttractSound.Play(ForkLiftAudioSource);
                }
                else
                {
                    AttractFailedSound.Play(ForkLiftAudioSource);
                }
                // isAttracting = true;
            }
        }
        if (isChargingPush && (Input.GetButton("Fire1") || fire1AxisTrue))           // Charging...
        {
            timeCharged += Time.deltaTime;
            fullyChargedEmission.rateOverTime = 40 * Mathf.Clamp01(1 - (MaxChargeTime - timeCharged)) + 10;
            // FullyChargedEffect.emission = fullyChargedEmission;
            if (timeCharged >= MaxChargeTime && !fullyChargedSoundPlayed)
            {
                fullyChargedSoundPlayed = true;
                FullyChargedSound.Play(ForkLiftAudioSource);
                // FullyChargedEffect.SetActive(true);
            }
        }

        if (isChargingPush && (Input.GetButtonUp("Fire1") || fire1AxisUp))           // Actually pushing
        {
            if (currentlyPickedUp != null)
            {
                fullyChargedSoundPlayed = false;
                currentlyPickedUp.GetComponent <Rigidbody>().isKinematic = false;
                currentlyPickedUp.GetComponent <BoxCollider>().enabled   = true;
                currentlyPickedUp.GetComponent <Box>().StartThrowing(Mathf.Clamp01(1 - (MaxChargeTime - timeCharged)));

                BoxThrowEvent.Raise();
                if (timeCharged > .8f)
                {
                    BoxLongThrowEvent.Raise();
                }

                PushObjectAway();
                currentlyPickedUp = null;
                FullyChargedEffect.Stop();
                ForkLiftAudioSource.Stop();
                ThrowSound.Play(ForkLiftAudioSource);
            }
            isAttracting   = false;
            isChargingPush = false;
        }

        AttractUsingLerp();
    }
예제 #10
0
 public void OnWrongBoxPickedUp()
 {
     WrongBoxPickedUpSound.Play(ForkLiftAudioSource);
 }
예제 #11
0
파일: Box.cs 프로젝트: bitowl/ld42
 public void OnIncinerate()
 {
     BoxIncinerateSound.Play(BoxAudioSource);
 }