public IEnumerator PlayAnimation(string AnimationName) { Debug.Log ("PlayAnimation(): " + AnimationName); Anim = gameObject.GetComponent<Animator>(); Anim.Play(AnimationName,0,0); yield return new WaitForSeconds(1.65f) ; Anim.StopPlayback(); }
// public GameObject getRagDollGameObject() // { // return rgb; // } public IEnumerator PlayPowerAnimationAndInstantiate(string AnimationName, float Power, float Velocity) { Debug.Log ("PlayPowerAnimationAndInstantiate(): " + AnimationName); Anim = gameObject.GetComponent<Animator>(); Anim.Play(AnimationName,0,0); yield return new WaitForSeconds(1.65f) ; Anim.StopPlayback(); GameObject PrisonerToFire = CopSetup.GetNextPrisoner(); PrisonerToFireFinal = (GameObject)Instantiate(PrisonerToFire, spawnPoint.transform.position, Quaternion.identity); //rgb=(GameObject)Instantiate(ragDoll,spawnPoint.transform.position,Quaternion.identity); Transform Direction = spawnPoint.transform; Component [] rgbs = PrisonerToFireFinal.GetComponentsInChildren(typeof(Rigidbody)); foreach(Rigidbody rigidBDY in rgbs) { rigidBDY.AddForce(Direction.forward * Power); rigidBDY.AddForce(Direction.up * (Velocity)); } cameraMovement.prisonerT = PrisonerToFireFinal.transform.GetChild(1).gameObject; cameraMovement.spawned = true; }
// Update is called once per frame void Update() { // Get player HP from PlayerStats script playerHp = targetObject.GetComponent <PlayerStats>().playerHP; bar.fillAmount = hp / initHp; //enemy.GetComponent<SimpleHealthBar>().UpdateBar(hp, 2f); if (hp > 0) { /*******************************/ /* Detected state */ /*******************************/ // Determine distance from target float distance = Vector3.Distance(target.position, transform.position); /*******************************/ /* Follow state */ /*******************************/ // If target is within radius start moving the NavMeshAgent if ((distance) <= detectionRadius) { anim.SetBool("isWalking", true); agent.SetDestination(target.position); } /*******************************/ /* Stop state */ /*******************************/ // Reached player now determine action if (distance <= 3f) { agent.isStopped = true; anim.SetBool("isWalking", false); anim.StopPlayback(); /*******************************/ /* Attack state */ /*******************************/ if (playerHp > 0) { // Call Co-routine for attacking in intervals if (canAttack) { StartCoroutine(wait()); } } else { // Player dead agent.SetDestination(startPos); } } else { agent.isStopped = false; } if (distance > 30f) { agent.SetDestination(startPos); } } else { // Death animation plays and despawn Skeleton anim.Play("Death"); agent.isStopped = true; Destroy(gameObject, 1.5f); } }
void Start() { Application.runInBackground = true; anim = GetComponent<Animator>(); anim.StopPlayback(); }
public void PreviousClick() { if (loopSelection == false) { if (index != 0) { labelHelper.text = label.text; if (index == 0) { index = itemList.Count - 1; } else { index--; } label.text = itemList[index].itemTitle; try { itemList[index].onValueChanged.Invoke(); } catch { } selectorEvent.Invoke(index); selectorAnimator.Play(null); selectorAnimator.StopPlayback(); if (invertAnimation == true) { selectorAnimator.Play("Forward"); } else { selectorAnimator.Play("Previous"); } if (saveValue == true) { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index); } } } else { labelHelper.text = label.text; if (index == 0) { index = itemList.Count - 1; } else { index--; } label.text = itemList[index].itemTitle; try { itemList[index].onValueChanged.Invoke(); } catch { } selectorEvent.Invoke(index); selectorAnimator.Play(null); selectorAnimator.StopPlayback(); if (invertAnimation == true) { selectorAnimator.Play("Forward"); } else { selectorAnimator.Play("Previous"); } if (saveValue == true) { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index); } } if (saveValue == true) { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index); } if (enableIndicators == true) { for (int i = 0; i < itemList.Count; ++i) { GameObject go = indicatorParent.GetChild(i).gameObject; Transform onObj; onObj = go.transform.Find("On"); Transform offObj; offObj = go.transform.Find("Off"); if (i == index) { onObj.gameObject.SetActive(true); offObj.gameObject.SetActive(false); } else { onObj.gameObject.SetActive(false); offObj.gameObject.SetActive(true); } } } }
public void EndJump() { characterAnimator.StopPlayback(); }
public void PlaySpawn() { monsterAnimator.StopPlayback(); monsterAnimator.Play("BMaze_Spawn", -1, 0f); }
private void TriggerAnimations() { _triggerd = true; _animator.StopPlayback(); }
public override void StartGame() { snakeAnimator.StopPlayback(); snakeAnimator.Play("New State"); base.StartGame(); }
public void Stop() { animator.StopPlayback(); }
static public void SampleAnim(this Animator animator, string stateName, float normalizedTime, int layer = -1) { animator.StopPlayback(); animator.Play(stateName, layer, normalizedTime); animator.StartPlayback(); }
// Use this for initialization void Start() { anim = GetComponent<Animator>(); anim.StopPlayback(); }
private void Awake() { FadeAnimator.StopPlayback(); FadeCanvas.gameObject.SetActive(false); }
private void Start() { animator.StopPlayback(); }
private void Update() { if (!isMovementEnabled) { return; } // Get input direction. inputDirection = Vector3.zero; if (Input.GetKey(KeyCode.LeftArrow) || Input.GetAxisRaw("Horizontal") == -1f) { inputDirection.x = -1f; } if (Input.GetKey(KeyCode.RightArrow) || Input.GetAxisRaw("Horizontal") == 1f) { inputDirection.x = 1f; } if (Input.GetKey(KeyCode.UpArrow) || Input.GetAxisRaw("Vertical") == 1f) { inputDirection.z = 1f; } if (Input.GetKey(KeyCode.DownArrow) || Input.GetAxisRaw("Vertical") == -1f) { inputDirection.z = -1f; } if (Input.GetKey(KeyCode.Space) || Input.GetButton("Submit")) { inputDirection = Vector3.zero; } if (inputDirection != Vector3.zero) { // Start animation m_Animator.StopPlayback(); // Test for random encounter Services.battleChanceManager.TestForBattle(); // Rotate body Quaternion towardsRotation = Quaternion.LookRotation(inputDirection, Vector3.up); newBodyRotation = Quaternion.RotateTowards( Quaternion.Euler(newBodyRotation), towardsRotation, bodyRotateSpeed * Time.deltaTime) .eulerAngles; newBodyRotation.x = transform.localRotation.eulerAngles.x; newBodyRotation.z = transform.localRotation.eulerAngles.y; bodyRoot.localRotation = Quaternion.Euler(newBodyRotation); // Move m_Rigidbody.MovePosition(transform.position + inputDirection.normalized * moveSpeed * Time.deltaTime); // Jitter bodyRoot.transform.localPosition += Random.insideUnitSphere * 0.01f * Time.deltaTime; } else { m_Animator.StartPlayback(); } }
private void Update() { if (!isSampling) { return; } int totalFrams = (int)(gpuSkinClip.length * gpuSkinClip.frameRate); samplingTotalFrams = totalFrams; if (samplingFrameIndex >= totalFrams) { if (animator != null) { animator.StopPlayback(); } string savePath = null; if (animData == null) { savePath = EditorUtility.SaveFolderPanel("GPUSkinning Animation Data Save", GetUserPreferDir(), string.Empty); } else { string animPath = AssetDatabase.GetAssetPath(animData); savePath = new FileInfo(animPath).Directory.FullName.Replace('\\', '/'); } if (!string.IsNullOrEmpty(savePath)) { if (!savePath.Contains(Application.dataPath.Replace('\\', '/'))) { ShowDialog("Must select a directory in the project's Asset folder."); } else { SaveUserPreferDir(savePath); string dir = "Assets" + savePath.Substring(Application.dataPath.Length); string savedAnimPath = dir + "/GPUSKinAnimData_" + animName + ".asset"; SetTextureInfo(gpuSkinAnimData); EditorUtility.SetDirty(gpuSkinAnimData); if (animData != gpuSkinAnimData) { AssetDatabase.CreateAsset(gpuSkinAnimData, savedAnimPath); } WriteTempData(TEMP_SAVED_ANIM_PATH, savedAnimPath); animData = gpuSkinAnimData; if (samplingClipIndex == 0) { Mesh newMesh = CreateNewMesh(smr.sharedMesh, "GPUSkinning_Mesh"); if (savedMesh != null) { newMesh.bounds = savedMesh.bounds; } string savedMeshPath = dir + "/GPUSKinMesh_" + animName + ".asset"; AssetDatabase.CreateAsset(newMesh, savedMeshPath); WriteTempData(TEMP_SAVED_MESH_PATH, savedMeshPath); savedMesh = newMesh; // CreateShaderAndMaterial(dir); // CreateLODMeshes(newMesh.bounds, dir); } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); } } isSampling = false; return; } float time = gpuSkinClip.length * ((float)samplingFrameIndex / totalFrams); GPUSkinFrame frame = new GPUSkinFrame(); gpuSkinClip.frames[samplingFrameIndex] = frame; frame.matrices = new Matrix4x4[gpuSkinAnimData.bones.Count]; if (animation == null) { animator.playbackTime = time; animator.Update(0); } else { animation.Stop(); AnimationState animState = animation[animClip.name]; if (animState != null) { animState.time = time; animation.Sample(); animation.Play(); } } StartCoroutine(SamplingCoroutine(frame, totalFrams)); }
private void DoTheThing() { GameManager.Instance.SetGuestDead(); animator.StopPlayback(); }
public void Stop() { anim.StopPlayback(); aSource.Pause(); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); anim.StopPlayback(); anim.speed = 25; }
public void StopAttacking() { animator.StopPlayback(); StopAllCoroutines(); }
public void Exit() { ParentAnimator.StopPlayback(); }
public void closedDoorClicked() { leftDoorAnimator.StopPlayback(); rightDoorAnimator.StopPlayback(); StartCoroutine(Example()); }
public void PreviousClick() { if (loopSelection == false) { if (index != 0) { labeHelper.text = label.text; if (index == 0) { index = itemList.Count - 1; } else { index--; } label.text = itemList[index].itemTitle; itemList[index].onValueChanged.Invoke(); selectorAnimator.Play(null); selectorAnimator.StopPlayback(); if (invertAnimation == true) { selectorAnimator.Play("Forward"); } else { selectorAnimator.Play("Previous"); } if (saveValue == true) { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index); } } } else { labeHelper.text = label.text; if (index == 0) { index = itemList.Count - 1; } else { index--; } label.text = itemList[index].itemTitle; itemList[index].onValueChanged.Invoke(); selectorAnimator.Play(null); selectorAnimator.StopPlayback(); if (invertAnimation == true) { selectorAnimator.Play("Forward"); } else { selectorAnimator.Play("Previous"); } if (saveValue == true) { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index); } } }
private void WhenDead() { _animator.StopPlayback(); StopAllCoroutines(); }
public void PlaySpawn() { animComp.StopPlayback(); animComp.Play("BMaze_Spawn", -1, 0f); }
private void Start() { animator = GetComponent <Animator>(); animator.StopPlayback(); }
public void Exit() { ObjectAnimator.StopPlayback(); }
public void Stop() { anim.StopPlayback(); Destroy(this); }
public void AnimationEnded() { _animator.StopPlayback(); Destroy(gameObject); }
/// <summary> /// Stops the animation and hides the sprite. /// </summary> void HideAnimation() { m_Renderer.enabled = false; m_Animator.StopPlayback(); }
public override void StopPlayback() { animator.StopPlayback(); }
// Use this for initialization void Start() { pushback = 0.3f; worth = 160; moveSpeed = 1.5f; moveSpeedOriginal = moveSpeed; currentHealth = 200; maxHealth = 200; isStunned = false; isMoving = false; immunityFrames = false; stunDuration = 0; player = GameObject.FindGameObjectWithTag("Player"); //pc = player.GetComponent(typeof(PlayerController)) as PlayerController; GameObject sw = this.gameObject.transform.GetChild(0).transform.GetChild(0).transform.GetChild(0).gameObject; hitcollider = sw.GetComponent(typeof(BoxCollider2D)) as BoxCollider2D; GameObject parent = this.gameObject.transform.GetChild(0).gameObject; anm = parent.GetComponent(typeof(Animator)) as Animator; hitcollider.enabled = false; anm.StopPlayback(); }
// Update is called once per frame public void Update() { //---- if (!buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { _keeptMoving(true); } else { _stopMoving(); } //---- //----movement---- if (buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && !buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { animator.SetInteger("State", 0); _keeptMoving(false);//left } else if (!buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { animator.SetInteger("State", 1); _keeptMoving(true);//right } else { animator.StopPlayback(); animator.SetInteger("State", -1); _stopMoving(); } //----End of movement---- switch (lightStatus) { case LightStatus.Off: break; case LightStatus.Off2On: _l2d_timer += Time.deltaTime; if (_l2d_timer > l2d_TimeSet) { _l2d_timer = 0f; lightStatus = LightStatus.On; } else { l2dObj.intensity = (_l2d_timer / l2d_TimeSet) * _l2d_IntensitySet; l2dObj.pointLightOuterRadius = (_l2d_timer / l2d_TimeSet) * _l2d_outerRadiusSet; } break; case LightStatus.On: break; case LightStatus.On2Off: _l2d_timer += Time.deltaTime; if (_l2d_timer > l2d_TimeSet) { _l2d_timer = 0f; lightStatus = LightStatus.Off; } else { l2dObj.intensity = ((l2d_TimeSet - _l2d_timer) / l2d_TimeSet) * _l2d_IntensitySet; l2dObj.pointLightOuterRadius = ((l2d_TimeSet - _l2d_timer) / l2d_TimeSet) * _l2d_outerRadiusSet; } break; default: break; } switch (scriptState) { case ScriptState.OnWaiting: if (!_isFirst) { _setControlmode(true); } break; case ScriptState.OnDoing: _setControlmode(false); switch (onDoingStatus) { case OnDoingStatus.Normal_On: //normal if (mbmNormal.StableFlag == true) { onDoingStatus = OnDoingStatus.Normal_Hold; } break; case OnDoingStatus.Normal_Hold: //等待mbmNormal加载完毕后 if (mbmNormal.Status == MsgBoxManager.MsgBoxStatus.Hidding && mbmNormal.StableFlag) { if (_isFirst) { lightStatus = LightStatus.Off2On; _setControlmode(true); _isFirst = false; scriptState = ScriptState.OnWaiting; break; } scriptState = ScriptState.OnWaiting; } break; case OnDoingStatus.Bg_On: //background if (mbmBg.StableFlag == true) { onDoingStatus = OnDoingStatus.Bg_Hold; } break; case OnDoingStatus.Bg_Hold: //等待mbmNormal加载完毕后 if (mbmBg.Status == MsgBoxManager.MsgBoxStatus.Hidding && mbmBg.StableFlag) { if (_isFirst) { thingsToSayPointer++; _StartShowThing("身边一片漆黑。^", mbmNormal); break; } scriptState = ScriptState.OnWaiting; } break; } break; default: break; } }
// Update is called once per frame void Start() { anim = GetComponentInChildren <Animator>(); anim.StopPlayback(); }
private void OnDisable() { _animator.StopPlayback(); }
// Use this for initialization void Awake () { anim = GetComponent<Animator>(); anim.StopPlayback (); }
// Use this for initialization void Start() { pushback = 0.2f; worth = 5000; moveSpeed = 2f; moveSpeedOriginal = moveSpeed; currentHealth = 1800; maxHealth = 2000; isStunned = false; isMoving = false; immunityFrames = false; stunDuration = 0; candrown = false; player = GameObject.FindGameObjectWithTag("Player"); //pc = player.GetComponent(typeof(PlayerController)) as PlayerController; groundslam = transform.GetChild(0).transform.GetChild(0).transform.GetChild(7).gameObject; anm = transform.GetChild(0).transform.GetChild(0).gameObject.GetComponent<Animator>(); laserL = transform.GetChild(0).transform.GetChild(0).transform.GetChild(3).transform.GetChild(0).transform.GetChild(1).gameObject; tentacleL = transform.GetChild(0).transform.GetChild(0).transform.GetChild(3).transform.GetChild(0).transform.GetChild(0).gameObject; jointL = transform.GetChild(0).transform.GetChild(0).transform.GetChild(3).transform.GetChild(1).gameObject; laserM = transform.GetChild(0).transform.GetChild(0).transform.GetChild(4).transform.GetChild(0).transform.GetChild(1).gameObject; tentacleM = transform.GetChild(0).transform.GetChild(0).transform.GetChild(4).transform.GetChild(0).transform.GetChild(0).gameObject; jointM = transform.GetChild(0).transform.GetChild(0).transform.GetChild(4).transform.GetChild(1).gameObject; laserR = transform.GetChild(0).transform.GetChild(0).transform.GetChild(5).transform.GetChild(0).transform.GetChild(1).gameObject; tentacleR = transform.GetChild(0).transform.GetChild(0).transform.GetChild(5).transform.GetChild(0).transform.GetChild(0).gameObject; jointR = transform.GetChild(0).transform.GetChild(0).transform.GetChild(5).transform.GetChild(1).gameObject; groundslam.SetActive(false); laserL.SetActive(false); laserR.SetActive(false); laserM.SetActive(false); jointL.SetActive(false); jointM.SetActive(false); jointR.SetActive(false); tentacleL.SetActive(false); tentacleR.SetActive(false); tentacleM.SetActive(false); anm.StopPlayback(); }