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 GameDBharat · Mar 13, 2020 at 07:45 AM · animationcharacterwalkingdeathattacking

how to make a character Animation walk,idle,Attack and death ? its should do all these things 2.5 Isometric way.

please anyone can help me with this thing. I want it like A.I (walk,attack and death).

  private void Update()
 {
     //depending on origin 

  if (GameController.Instance.GetCurrentActiveScene() == Constants.LevelScene.Empire)
     {
         Move();
     }
 } 

 private void Move()
 {
     switch (_person.DirectionOfPerson)
     {
         case Constants.MovementDirections.North:
             transform.position += new Vector3(-0.8f * _person.MoveSpeed * Time.deltaTime, 0.5f * _person.MoveSpeed * Time.deltaTime, 0);
             _personAnimation.SetInteger("Direction", (int)Constants.MovementDirections.North);
             break;
         case Constants.MovementDirections.East:
             transform.position += new Vector3(0.8f * _person.MoveSpeed * Time.deltaTime, 0.5f * _person.MoveSpeed * Time.deltaTime, 0);
             _personAnimation.SetInteger("Direction", (int)Constants.MovementDirections.East);
             break;
         case Constants.MovementDirections.South:
             transform.position += new Vector3(0.8f * _person.MoveSpeed * Time.deltaTime, -0.5f * _person.MoveSpeed * Time.deltaTime, 0);
             _personAnimation.SetInteger("Direction", (int)Constants.MovementDirections.South);
             break;
         case Constants.MovementDirections.West:
             transform.position += new Vector3(-0.8f * _person.MoveSpeed * Time.deltaTime, -0.5f * _person.MoveSpeed * Time.deltaTime, 0);
             _personAnimation.SetInteger("Direction", (int)Constants.MovementDirections.West);
             break;

     }
 }

  private void OnTriggerEnter2D(Collider2D collision)
 {
     CurrentDirection = _person.DirectionOfPerson;
     if (GameController.Instance.GetCurrentActiveScene() == Constants.LevelScene.MyEmpire)
     {

         if (collision.gameObject.CompareTag("Troop"))  // to detect the troop collision to another troop
         {
             changeAntiClockwiseDirection();
         }
         else if (collision.gameObject.CompareTag("Wall"))  //to check the wall the detection
         {
             changeToOppositeDirection();
         }
     }
 }

 public void changeAntiClockwiseDirection()
 {
     if (CurrentDirection == Constants.MovementDirections.North)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.West;
     }
     else if (CurrentDirection == Constants.MovementDirections.South)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.East;
     }
     else if (CurrentDirection == Constants.MovementDirections.East)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.North;
     }
     else if (CurrentDirection == Constants.MovementDirections.West)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.South;
     }
 }

 public void changeClockwiseDirection()
 {
     if (CurrentDirection == Constants.MovementDirections.North)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.East;
     }
     else if (CurrentDirection == Constants.MovementDirections.East)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.South;
     }
     else if (CurrentDirection == Constants.MovementDirections.South)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.West;
     }
     else if (CurrentDirection == Constants.MovementDirections.West)
     {
         _person.DirectionOfPerson = Constants.MovementDirections.North;
     }
     else
     {
         Debug.Log("Unknown Direction in clockwise direction method");
     }
 }
Comment
Add comment · Show 2
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 Getsumi3 · Mar 04, 2020 at 08:12 AM 0
Share

It's not how Unity Answers works.


There are lot of tutorials on youtube. Go and watch some. Try it yourself. And then if you still don't succeed come here, show us your code/screenshots of what you tried and we will help you with an advice or even a piece of code.

avatar image GameDBharat Getsumi3 · Mar 13, 2020 at 04:31 AM 0
Share

code has been posted as you said. i have tried many tutorials. it was not working. thanks a lot man. i have created 3 animator for all direction like for idle , attack , death. different animator different situation. is that right what i did?

0 Replies

· Add your reply
  • Sort: 

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

329 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 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 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

how to add a walking animation when character is moving? 3 Answers

Combining two animations? 2 Answers

character death - In transitions settings, where is ‘can transition to self’? 3 Answers

Help with attacking, and death animation. Unity 5 javascript 1 Answer

Importing character + animations, and blend/scripting - looking for an up to date tutorial? 0 Answers


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