Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Ielboys · Feb 24, 2019 at 08:47 PM · 3dcombatcombo

3D Combo system?

I looked up few scripts before asking his question but I coludn't do it. I can't even play the first animation. Any help would be appreciated.

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class combo : MonoBehaviour {

 Animator animator;//You may not need an animator, but if so declare it here   

 int noOfClicks; //Determines Which Animation Will Play
 bool canClick; //Locks ability to click during animation event

 void Start()
 {
     //Initialize appropriate components
     animator = GetComponent<Animator>();

     noOfClicks = 0;
     canClick = true;
 }

 void Update()
 {
     if (Input.GetMouseButtonDown(0)) { ComboStarter(); }
 }

 void ComboStarter()
 {
     if (canClick)
     {
         noOfClicks++;
     }

     if (noOfClicks == 1)
     {
         animator.SetInteger("condition", 30);
     }
 }

 public void ComboCheck()
 {

     canClick = false;

     if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack1") && noOfClicks == 1)
     {//If the first animation is still playing and only 1 click has happened, return to idle
         animator.SetInteger("animation", 0);
         canClick = true;
         noOfClicks = 0;
     }
      if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack1") && noOfClicks >= 2)
     {//If the first animation is still playing and at least 2 clicks have happened, continue the combo          
         animator.SetInteger("condition", 31);
         canClick = true;
     }
      if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack2") && noOfClicks == 2)
     {  //If the second animation is still playing and only 2 clicks have happened, return to idle         
         animator.SetInteger("condition", 0);
         canClick = true;
         noOfClicks = 0;
     }
      if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack2") && noOfClicks >= 3)
     {  //If the second animation is still playing and at least 3 clicks have happened, continue the combo         
         animator.SetInteger("condition", 32);
         canClick = true;
     }
      if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack3"))
     { //Since this is the third and last animation, return to idle          
         animator.SetInteger("condition", 0);
         canClick = true;
         noOfClicks = 0;
     }
 }

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alpezaxxx · Feb 24, 2019 at 09:40 PM 0
Share

i use this script.. this scripts i found on youtube. andd it work for me... you need setup animation event corretly

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mehedihasanp78 · Nov 02, 2020 at 07:27 AM

You need to add " ComboCheck() " in every attack animation event. such as... alt text


screenshot-2.png (55.0 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

120 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

i'm trying to create a combo system 2 Answers

When I want to kill an enemy with a strong attack, the enemy just gets stuck. How do I fix this? 1 Answer

Replacing OverlapSphere with colliders (Detecting weapon collision with enemies - SOLVED) 1 Answer

Masking sprites in 3d 0 Answers

Prevent object stretching at higher FOV 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges