if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, 100.0f)) { if (particleNum >= 0 && particleNum <= 3) { effectPrefab = (GameObject)Instantiate(particlePrefab[particleNum], new Vector3(hit.point.x, hit.point.y + 0.2f, hit.point.z), Quaternion.Euler(0, 0, 0)); } if (particleNum >= 4 && particleNum <= 10) { effectPrefab = (GameObject)Instantiate(particlePrefab[particleNum], new Vector3(hit.point.x, hit.point.y + 1.0f, hit.point.z), Quaternion.Euler(0, 0, 0)); } } }
using UnityEngine; using System.Collections; using SonicBloom.Koreo; using SonicBloom.Koreo.Players; using UnityEngine.UI; public class MusicPlayerController : MonoBehaviour { SimpleMusicPlayer simplePlayer; private CameraPathAnimator animator; public Text PathPctText; public Slider Scrub; void Start () { simplePlayer = gameObject.GetComponent<SimpleMusicPlayer>(); animator = GameObject.Find("Argos_Camera_Path").GetComponent<CameraPathAnimator>(); animator.playOnStart = false; animator.Stop(); PathPctText.text = "Stopped"; } public void onPlayButtonDown() { simplePlayer.Play(); animator.Play(); } public void onStopButtonDown() { simplePlayer.Stop(); animator.Stop(); PathPctText.text = "Stopped"; } public void onPauseDown() { simplePlayer.Pause(); animator.Pause(); } public void onScrub() { float val = Scrub.value; int totalSamps = simplePlayer.GetTotalSampleTimeForClip(simplePlayer.GetCurrentClipName()); int targSamp = (int)(val * (float)totalSamps); simplePlayer.SeekToSample(targSamp); animator.Seek(val); } void Update() { PathPctText.text = animator.percentage.ToString(); } }