void HandleCustomEvent(Spine.TrackEntry trc, Spine.Event e) { if (e.Data.Name == "start" || e.Data.Name == "jump_start") { move = true; if (height > 0) { timer = jumpFlightTime; if (curChar.jumpVoice != null && canTalk) { charVoice = LeanAudio.play(curChar.jumpVoice, 1f); } } else { timer = fallFlightTime; if (curChar.fallVoice != null && canTalk) { charVoice = LeanAudio.play(curChar.fallVoice, 1f); } } if (curChar.jumpSound != null) { charVoice = LeanAudio.play(curChar.jumpSound, 1f); } } if (e.Data.Name == "jump_end") { move = false; if (!hasPicked) { if (dropMgr.enabled) { //Debug.Log ("Character Shifts index"); dropMgr.ShiftIndex(-(int)Mathf.Sign(height)); } //Debug.Log ("Jump End " + Time.time); hasPicked = true; if (curChar.landSound != null) { charVoice = LeanAudio.play(charStorage.GetCharacter(Persistence.currentChar).landSound); } } } if (e.Data.Name == "particle" || e.Data.Name == "particles") { Debug.Log("CALL FOR PARTICLES!"); if (curChar.particle != null) { GameObject p = Instantiate(curChar.particle, transform.position + Vector3.up, curChar.particle.transform.rotation); p.transform.parent = FindObjectOfType <DropManager> ().topItemTransform; ParticleSystem sys = p.GetComponent <ParticleSystem> (); //sys.main.loop = false; sys.Play(); Destroy(p, sys.main.duration); } } if (e.Data.Name == "sound" || e.Data.Name == "sfx") { } }
void Update() { if (ClimberStateManager.state == ClimberState.MOVING && queue.Count > 0) { timer -= Time.deltaTime; float t = 1 - (timer / _slideTime); stairCtrl.UpdateStairs(direction, moveAnimation.Evaluate(t)); character.UpdateReturn(moveAnimation.Evaluate(t)); camCtrl.UpdateCam(moveAnimation.Evaluate(t) * direction); if (timer < 0) { OnEndMove(); } } if (ClimberStateManager.isFlying) { if (queue.Count > 0) { if (smallButton && smallButton.isShowing) { smallButton.Hide(); } timer -= Time.deltaTime; float t = 1 - (timer / _slideTime); stairCtrl.UpdateStairs(direction, t); if (timer < 0) { adjustFlight = false; RemoveQueue(); //queue.RemoveAt (0); jumpCount += direction; dropMgr.ShiftIndex(-1); stairCtrl.SnapBack(); if (queue.Count == 0) { EndFlight(); } else { timer = _slideTime; //dropMgr.SpawnRandom (dropMgr.spawnPos, 7); dropMgr.SpawnRandom(7, 7); } } } else { EndFlight(); } } // else if (ClimberStateManager.state == ClimberState.SLIDING){ // timer -= Time.deltaTime; // // float t = timer / 1; // // // if (direction < 0){ // t = 1 - (timer / 1); // } // camCtrl.UpdateCamRaw (t); // if (timer < 0.15f){ // if (direction > 0) { // // //Loop (); // camCtrl.progress = 0.15f; // camCtrl.shiftCount += 1; // callback (); // } // else if (direction <0){ // camCtrl.progress = 0.85f; // camCtrl.shiftCount -= 1; // callback (); // } // } // // // } // if (ClimberStateManager.state == ClimberState.PAUSE && (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.KeypadEnter))){ // TogglePause (); // } }