public void GameOver() { ScoreTextGameOver.text = Player.Instance.ScoreText.text; InGameGameOverMenu.SetActive(true); animatorBraids.StartPlayback(); }
public void Show_Sudden() { if (!inited) { Init(); } if (showed) { return; } showed = true; gameObject.SetActive(true); SetRaycasting(true); if (animator != null) { if (!animator.isInitialized) { animator.StartPlayback(); animator.speed = speed_animator; } animator.Play("showed"); } }
// Use this for initialization void Start() { time = Random.Range(30, 60); countdown = 30; StartCoroutine(ChangeTime()); textFlash.StartPlayback(); metalMusic.Play(); score = startScore; }
public void EndEffect() { transform.position = Camera.main.WorldToScreenPoint(Player.transform.position); animator.StartPlayback(); animator.speed = -2f; animator.Play("LevelIntro"); }
private void Bake() { if (m_HasBake) { return; } if (Application.isPlaying || effectAnim == null) { return; } const float frameRate = 30.0f; int frameCount = ((clip.Length * (int)frameRate) + 2); effectAnim.Rebind(); effectAnim.StopPlayback(); effectAnim.recorderStartTime = 0.0f; effectAnim.StartRecording(frameCount); for (int i = 0; i < frameCount - 1; i++) { effectAnim.Update(1.0f / frameRate); } effectAnim.StopRecording(); effectAnim.StartPlayback(); m_HasBake = true; m_RecorderStopTime = effectAnim.recorderStopTime; }
public static float BakeCurrent(this Animator animator) { animator.Rebind(); animator.StopPlayback(); animator.recorderStartTime = 0; // 这里可以在指定的时间触发新的动画状态 AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0); //const float frameRate = 30f; //int frameCount = (int)((Duration * frameRate) + 2); // 开始记录指定的帧数 animator.StartRecording(0); while (info.normalizedTime < 1f) { // 记录每一帧 animator.Update(1.0f / 30); info = animator.GetCurrentAnimatorStateInfo(0); //Debug.Log(info.length); //Debug.Log(info.normalizedTime); } // 完成记录 animator.StopRecording(); // 开启回放模式 animator.StartPlayback(); return(info.length); }
public void TurnDynamics(bool bON) { NoisePosFromBegin[] nposes = _BCurveFromTFs.GetComponentsInChildren <NoisePosFromBegin> (); foreach (var np in nposes) { np.enabled = bON; } PlaceAlongLineSegment[] placers = GetComponentsInChildren <PlaceAlongLineSegment> (); foreach (var p in placers) { p.enabled = bON; } if (bON) { _AnimRingLine.StartPlayback(); } else { _AnimRingLine.StopPlayback(); } }
void AnimaterHongPei(AnimatorState state) { if (Application.isPlaying || state == null || !lockSelection) { return; } aniTime = 0.0f; aniTime = GetClip(state.motion.name).length; float frameRate = 30f; int frameCount = (int)((aniTime * frameRate) + 2); animator.StopPlayback(); animator.Play(state.name); animator.recorderStartTime = 0; animator.StartRecording(frameCount); for (var j = 0; j < frameCount - 1; j++) { animator.Update(1.0f / frameRate); } animator.StopRecording(); RecordEndTime = animator.recorderStopTime; animator.StartPlayback(); hongPei = true; }
private void Awake() { _animator = GetComponent <Animator>(); _triggerd = false; // _animator.StopPlayback(); _animator.StartPlayback(); }
public override void Press(TouchCover _touchCover) { this.touchCover = _touchCover; if (!isClickable) { return; } isClickable = false; isFinish = true; isMoveComplete = false; if (touchCover != null) { InGameUIController.Instance.CacheTouchForNote(touchCover, this); } MidiPlayer.Instance.PlayPianoNotes(data.notes, InGameUIController.Instance.gameplay.GetSpeedRatio(), true, data.soundDelay); InGameUIController.Instance.gameplay.IncreaseAndShowScore(); InGameUIController.Instance.gameplay.TileFinished(); AchievementHelper.Instance.LogAchievement("totalNoteHit"); //isClickable = false; if (GameConsts.isPlayAuto || InGameUIController.Instance.gameplay.isListenThisSong) { isActiveAuto = true; } blinkEffect.gameObject.SetActive(true); blinkEffect.StartPlayback(); if (!InGameUIController.Instance.gameplay.isListenThisSong) { //Debug.Log("Is listen this song; " + InGameUIController.Instance.gameplay.isListenThisSong); touchKeepEffect.OnTouchDown(gameObject, touchCover); } }
// Update is called once per frame private void Update() { if (vp.isPlaying) { if (MainMenuCanvas.gameObject.activeInHierarchy) { MainMenuCanvas.gameObject.SetActive(false); } } if (!vp.isPlaying) { if (!FadeCanvas.gameObject.activeInHierarchy) { FadeCanvas.gameObject.SetActive(true); FadeAnimator.StartPlayback(); FadeAnimator.Play("Fading"); } if (!MainMenuCanvas.gameObject.activeInHierarchy) { DelayedActivation(); } } }
public static void Play(this Animator _animator, string stateName, UnityAction callback = null, float speed = 1) { AnimationClip[] AnimationClips = _animator.runtimeAnimatorController.animationClips; float _time = 0; for (int i = 0; i < AnimationClips.Length; i++) { if (AnimationClips[i].name == stateName) { _time = AnimationClips[i].length; } } _animator.enabled = true; _animator.StartPlayback(); _animator.speed = speed; _animator.Play(stateName, 0, speed < 0 ? 1 : 0); DEVELOP_ANIMATOR_TIME_ID = TimerManager.Instance.StartTimer((float time) => { if (time >= _time) { callback?.Invoke(); TimerManager.Instance.EndTimer(DEVELOP_ANIMATOR_TIME_ID); } }); }
public void Sample() { AnimatorOverrideController aoc = new AnimatorOverrideController(Rac); List <KeyValuePair <AnimationClip, AnimationClip> > overrides = new List <KeyValuePair <AnimationClip, AnimationClip> >(); List <KeyValuePair <AnimationClip, AnimationClip> > overrides1 = new List <KeyValuePair <AnimationClip, AnimationClip> >(); aoc.GetOverrides(overrides); foreach (KeyValuePair <AnimationClip, AnimationClip> pair in overrides) { overrides1.Add(new KeyValuePair <AnimationClip, AnimationClip>(pair.Key, AniClip)); } aoc.ApplyOverrides(overrides1); Ani.runtimeAnimatorController = aoc; Ani.Rebind(); Ani.StopPlayback(); Ani.recorderStartTime = 0; int frameCount = (int)(AniClip.frameRate * AniClip.length); Ani.StartRecording(frameCount); for (int i = 0; i < frameCount; i++) { Ani.Update(1.0f / frameCount); } Ani.StopRecording(); Ani.playbackTime = 0; Ani.StartPlayback(); }
private void OnEnable() { Debug.Log("Started"); a = transform.GetComponent <Animator>(); a.StartPlayback(); }
public void Bake() { if (m_HasBake) { return; } if (Application.isPlaying || animatior == null) { return; } int frameCount = Mathf.RoundToInt((clipInfo[0].clip.length * clipInfo[0].clip.frameRate)); animatior.Rebind(); animatior.StopPlayback(); animatior.recorderStartTime = 0.0f; animatior.StartRecording(frameCount); for (int i = 0; i < frameCount - 1; i++) { animatior.Update(1.0f / clipInfo[0].clip.frameRate); } animatior.StopRecording(); animatior.StartPlayback(); m_HasBake = true; m_RecorderStopTime = animatior.recorderStopTime; }
public void TurnDynamics(bool bON) { if (bON) { _AnimBody.StartPlayback(); _AnimENCore.StartPlayback(); } else { _AnimBody.StopPlayback(); _AnimENCore.StopPlayback(); } Lyu.KeepOffset _kepOffset = GetComponent <Lyu.KeepOffset> (); if (_kepOffset != null) { _kepOffset.enabled = bON; } Lyu.GetPosOnLRPathCtrol getPoser = GetComponent <Lyu.GetPosOnLRPathCtrol> (); getPoser.enabled = bON; KeepPointTo dirKeeper = GetComponent <KeepPointTo> (); dirKeeper.enabled = bON; Lyu.LineRendererPathCtrl[] lrPthCtrls = GetComponentsInChildren <Lyu.LineRendererPathCtrl> (); foreach (var pthCtrl in lrPthCtrls) { pthCtrl.enabled = bON; } }
// Update is called once per frame /// <summary> /// This Update method checks to make sure we aren't awake yet. Once we are, we disable this script, and enable Ollie's ability to move. /// </summary> void Update() { gameObject.GetComponent <Slider>().value = awakeAmount; if (awakeAmount >= 100 && display.alpha > 0) { GameObject.Find("Ollie_Sprite").GetComponent <Ollie_Move>().enabled = true; display.alpha -= Time.deltaTime; animator.SetTrigger("Wakeup"); animator.Play("Wakeup"); animator.StartPlayback(); animator.speed = 1; subManager.DisplaySubtitle("Ollie: I guess I can try today..", 3); } if (awakeAmount > 0 && awakeAmount < 100) { awakeAmount -= (Time.deltaTime) * decaySpeed; gameObject.GetComponent <Slider>().value = awakeAmount; //Update the parent slider. } if (awakeAmount < 100) { if (Input.GetKeyDown(KeyCode.Space)) { awakeAmount += (fillAmount * fillMultipler); gameObject.GetComponent <Slider>().value = awakeAmount; //Update the parent slider. } } }
public void PlayBack() { if (recorderMode == AnimatorRecorderMode.Record) { Animator.StopRecording(); } if (recorderMode == AnimatorRecorderMode.Playback) { Animator.StopPlayback(); Animator.applyRootMotion = false; if (Rigid) { Rigid.isKinematic = false; } } else { Animator.StartPlayback(); if (Rigid) { Rigid.isKinematic = true; } Animator.applyRootMotion = true; } }
public void StartSpawning() { anim.StartPlayback(); //anim.Play(); anim.speed = 1.0f; SetActive(true); }
/// <summary> /// Changes pacman to a new state, executing any code that needs to be ran on a state change /// </summary> /// <param name="newState">Pacmans new state</param> void ChangeState(State newState) { currentState = newState; switch (newState) { case State.idle: anim.StartPlayback(); break; case State.moving: anim.StopPlayback(); break; case State.dead: trans.rotation = Quaternion.identity; anim.StopPlayback(); anim.Play("Pacman_Death"); // check if all players are dead if (GameLogic.instance.Pacman.CurrentState == State.dead) { GameLogic.instance.EndGame(3, false); } break; } }
/// <summary> /// Stop this track group and stop playback on animator. /// </summary> public override void Stop() { base.Stop(); if (!Application.isPlaying) { if (hasBeenBaked) { hasBeenBaked = false; Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { return; } if (animator.recorderStopTime > 0) { if (Actor.gameObject.activeInHierarchy) { animator.StartPlayback(); animator.playbackTime = 0; animator.Update(0); animator.StopPlayback(); animator.Rebind(); } } } } }
/// <summary> /// Initialize the Track Group as normal and initialize the Animator if in Editor Mode. /// </summary> public override void Initialize() { #if PROFILE_FILE Profiler.BeginSample("CharacterTrackGroup.Initialize"); #endif // PROFILE_FILE base.Initialize(); if (!Application.isPlaying) { if (Actor == null) { #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE return; } Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE return; } animator.StartPlayback(); } #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE }
// アニメーションの再生 void PlayBack() { // 録画してなければ何もしない if (animator.recorderStopTime <= 0) { return; } if (animator && recorderAnimator && !isPlayBack) { isPlayBack = true; animator.Rebind(); recorderAnimator.Rebind(); animator.StartPlayback(); recorderAnimator.StartPlayback(); animator.playbackTime = animator.recorderStartTime; recordTarget.transform.position = recordData.posList[0]; recordTarget.transform.rotation = recordData.rotList[0]; elapsedTime = 0.0f; animationIndex = 0; Debug.Log("アニメーションの再生"); } }
public static float Bake(this Animator animator, string action) { if (!string.IsNullOrEmpty(action)) { animator.Rebind(); animator.StopPlayback(); animator.recorderStartTime = 0f; animator.Play(action); AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); animator.StartRecording(0); while (currentAnimatorStateInfo.normalizedTime < 1f) { animator.Update(0.0333333351f); currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (currentAnimatorStateInfo.length <= 0f) { return(0f); } } animator.StopRecording(); animator.StartPlayback(); return(currentAnimatorStateInfo.length); } return(0f); }
// Update is called once per frame void Update() { if (animalAnimator == null) { return; } if (spriteRenderer == null) { return; } if (stateTimer <= 0.0f) { moving = !moving; if (moving) { animalAnimator.StopPlayback(); headingLeft = !headingLeft; } else { animalAnimator.StartPlayback(); } spriteRenderer.flipX = !headingLeft; stateTimer = Random.Range(1.0f, 2.0f); } stateTimer -= Time.deltaTime; if (moving) { transform.Translate((headingLeft ? Vector3.left : Vector3.right) * 2.0f * Time.deltaTime); } }
private void EnableMarker() { teleportMarker.SetActive(true); if (animationController != null) { animationController.StartPlayback(); } }
protected void ResumeAnimation() { if (animatorTimeline != null) { //animatorTimeline.Play(0); animatorTimeline.StartPlayback(); } }
//void OnTriggerEnter() //{ // bridgeAnim.Play("Take 001"); // buttonAnim.Play("Take 001"); //} void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "BridgeButton") { bridgeAnim.StartPlayback(); buttonAnim.StartPlayback(); } }
public void ChangeAnimatorSpeedFromLifespan(float lifespan) { animator.StartPlayback(); if (lifespan > 0) { animator.speed = 1 / lifespan; } }
// Update is called once per frame void Update() { if (!menu.Options) { if (DeathTimer > Time.fixedTime) { for (int i = 0; i < Bosss.Length; i++) { if (Bosss[i].GetComponent <Animator>() != null) { Bosss[i].GetComponent <Animator>().SetBool("Damage", true); } } anim.SetBool("Damage", true); } else { for (int i = 0; i < Bosss.Length; i++) { if (Bosss[i] != null) { if (Bosss[i].GetComponent <Animator>() != null) { Bosss[i].GetComponent <Animator>().SetBool("Damage", false); } } } anim.SetBool("Damage", false); anim.StopPlayback(); if (PlayerPrefs.GetInt(name + "Start") == 1) { anim.SetBool("Start", true); } PlayerPrefs.SetInt(name + "Start", 1); if (Timer < Time.fixedTime && TimerDeley > Time.fixedTime) { anim.SetInteger("State", Random.Range(0, MaxState)); Timer = Time.fixedTime + Timerdeley; TimerDeley = Time.fixedTime - 1; } if (Timer < Time.fixedTime && TimerDeley < Time.fixedTime) { anim.SetInteger("State", -1); TimerDeley = Time.fixedTime + 1f; } } } else { anim.StartPlayback(); } }
// Use this for initialization void Start () { if (centerAnchor != null) { oculus = true; } cursorAnimator = cursorAnimation.GetComponent<Animator> (); cursorAnimator.StartPlayback (); }