private void Play(object sender, RoutedEventArgs e) { List <musicBar> SortedBarList = barList.OrderBy(o => o.startTime).ToList(); for (int i = 0; i < 12000; i++) { List <musicBar> deleteList = new List <musicBar>(); foreach (musicBar mb in SortedBarList) { if (mb.startTime != i) { break; } audioPlayer a = new audioPlayer(); var thread = new Thread( () => a.playSound(mb)); thread.Start(); deleteList.Add(mb); } foreach (musicBar mb in deleteList) { SortedBarList.Remove(mb); } if (SortedBarList.Count == 0) { break; } Thread.Sleep(20); } // Note,,, wavetype - 1-5,,, length 50 = 1 sek,,, volume 0 - 100,,, vibrato 0 = null vibrato. 12 = holestep vibrato?,,, //vibratoinetnsity = how often the vibrato peaks. must be higher for higher frequencies, the higher- the less frequent. }
public void SetDirection(Vector2 direction) { //use the Run states by default string[] directionArray = null; //measure the magnitude of the input. if (direction.magnitude < .01f) { if (GameManager.isCollecting) { directionArray = chopDirections; } else { directionArray = staticDirections; audioPlayer.stopSound(); } } else { //we can calculate which direction we are going in //use DirectionToIndex to get the index of the slice from the direction vector //save the answer to lastDirection directionArray = runDirections; audioPlayer.playSound(0, false, 0.2f); lastDirection = DirectionToIndex(direction, 8); } //tell the animator to play the requested state // Debug.Log("Tilemap Size" + tilemap.size); animator.Play(directionArray[lastDirection]); }
// Update is called once per frame void Update() { if (lake) { myPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } else { myPosition = transform.position; } myPosition.z = 0.5f; distance = Mathf.Sqrt(Mathf.Pow((jacob.transform.position.x - myPosition.x), 2) + Mathf.Pow((jacob.transform.position.y - myPosition.y), 2)); if (clicking && collectable) { if (healthUsed == null) { healthUsed = Instantiate(health, new Vector3(0, 0, 0), Quaternion.identity); healthUsed.GetComponent <HealthBar>().setHpMax(pointsDeVieMax); healthUsed.transform.parent = GameObject.Find("CanvasHealthBar").transform; healthUsed.transform.position = (myPosition); } timeButtonHeld += Time.deltaTime; if (timeButtonHeld > 0.3) { pointsDeVie -= 1; timeButtonHeld = 0; healthUsed.GetComponent <HealthBar>().TakeDamage(1); if (this.tag != "Lakes") { audioPlayer.setPitch(2.0f); audioPlayer.playSound(0, false, 0.3f); } if (pointsDeVie <= 0) { clicking = false; GameManager.setIsCollecting(false); foreach (Ressource r in GameManager.items) { if (ressources.Contains(r.name)) { r.quantite += nbRessources[ressources.IndexOf(r.name)]; if (r.quantite < 0) { r.quantite = 0; } } } for (int i = 0; i < GameManager.tabBag.Count; i++) { if (GameManager.tabBag[i].name == ressource) { GameObject tmp = GameObject.Find("ButtonHUDMiddle" + (i + 1).ToString()); tmp.GetComponentInChildren <Text>().text = GameManager.tabBag[i].quantite.ToString(); } } if (this.tag != "Lakes") { Destroy(healthUsed); Destroy(gameObject); return; } else { pointsDeVie = pointsDeVieMax; healthUsed.GetComponent <HealthBar>().HealMax(); audioPlayer.playSound(0, false, 0.3f); } } } } }