-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
|
||
//Clase para sacar fotos o grabar videos | ||
public class ScreenshotManager : MonoBehaviour | ||
{ | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
if (Input.GetKeyDown(KeyCode.C)) TakeScreenshot("fotito"); | ||
} | ||
|
||
public void TakeScreenshot(string fileName) | ||
{ | ||
//sacar foto de toda la pila de piedras?Grabar gif? | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using Random = UnityEngine.Random; | ||
|
||
|
||
public class OnHitSound : MonoBehaviour | ||
{ | ||
public AudioClip hitSound; | ||
AudioSource _audioSource; | ||
Rigidbody2D _rb; | ||
|
||
private void Awake() | ||
{ | ||
_audioSource = GetComponent<AudioSource>(); | ||
_rb = GetComponent<Rigidbody2D>(); | ||
} | ||
|
||
|
||
public void ReproduceSound() | ||
{ | ||
if (_audioSource.isPlaying) return; | ||
_audioSource.clip = hitSound; | ||
_audioSource.pitch = Random.Range(0.9f, 1.1f); | ||
_audioSource.volume = Mathf.Clamp01(_rb.velocity.magnitude/ 20); | ||
_audioSource.Play(); | ||
} | ||
|
||
private void OnCollisionEnter2D(Collision2D other) | ||
{ | ||
ReproduceSound(); | ||
|
||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.