Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BattleSystem : MonoBehaviour
- {
- Animator animator;
- public int anim = 0;
- void Start()
- {
- animator = GameObject.Find("Player").GetComponent<Animator>();
- }
- void Update()
- {
- anim = animator.GetInteger("animation");
- if (Input.GetMouseButtonDown(0))
- {
- ComboCheck();
- }
- }
- private void ComboCheck()
- {
- if (animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
- {
- animator.SetInteger("animation", 2);
- }
- if (animator.GetCurrentAnimatorStateInfo(0).IsTag("Attack") && animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 0.85f)
- {
- if (animator.GetInteger("animation") == 4)
- {
- animator.SetInteger("animation", 2);
- }
- else
- {
- animator.SetInteger("animation", animator.GetInteger("animation") + 1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement