IEnumerator AttackSkill() { GetComponent <Animator>().SetBool("IsAttacking", true); //todo start animation heroContainer.StartSkill(HeroContainer.HeroType.Warrior); yield return(new WaitForSeconds(0.4f)); GetComponent <Animator>().SetBool("IsAttacking", false); }
private void FixedUpdate() { float vertical = rb.velocity.y; if (vertical < 0) { animator.SetBool("Ascending", false); } isOnGround = Physics2D.OverlapCircle(groundCheck.position, 0.4f, groundLayer); if (isOnGround) { didSecondJump = false; } base.FixedUpdate(); if (Mathf.Abs(Input.GetAxis("Ability")) < 0.1f && !finishedHolding) { finishedHolding = true; } if (isOnGround) { if (heroContainer.ninjaSkillState.isSkillActive && Input.GetAxis("Ability") > 0.3) { heroContainer.StartSkill(HeroContainer.HeroType.Ninja); rb.AddForce(Vector2.up * 40, ForceMode2D.Impulse); animator.SetTrigger("TakeOF"); animator.SetBool("Ascending", true); audio.PlayOneShot(audioClip); //TODO Start jump anim isOnGround = false; finishedHolding = false; didSecondJump = false; } } else { if (!didSecondJump && finishedHolding) { if (Input.GetAxis("Ability") > 0.3) { rb.AddForce(Vector2.up * 40, ForceMode2D.Impulse); animator.SetBool("Ascending", true); animator.SetTrigger("TakeOF"); audio.PlayOneShot(audioClip); //TODO Start jump anim didSecondJump = true; isOnGround = false; finishedHolding = false; } } } }
IEnumerator PrepareToDestroy() { GameObject wall = wallToDestroy; animator.SetBool("Hit", true); heroContainer.StartSkill(HeroContainer.HeroType.Tank); if (wall != null) { wall.GetComponent <DestroyableWall>().StartDestroying(); } yield return(new WaitForSeconds(1.3f)); animator.SetBool("Hit", false); }
IEnumerator StopSkill() { animator.SetBool("IsStopTime", true); timeSphere.GetComponent <Animator>().SetBool("StopTime", true); yield return(new WaitForSeconds(1)); heroContainer.StartSkill(HeroContainer.HeroType.Technomancer); timeSphere.SetActive(true); animator.SetBool("IsStopTime", false); timeSphere.GetComponent <Animator>().SetBool("StopTime", false); yield return(new WaitForSeconds(4)); timeSphere.SetActive(false); yield return(new WaitForSeconds(4)); }