Skip to content

Instantly share code, notes, and snippets.

@ray5527880
Created February 24, 2018 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ray5527880/d92ff83d253e785de2143bfa48feba4a to your computer and use it in GitHub Desktop.
Save ray5527880/d92ff83d253e785de2143bfa48feba4a to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class attack : MonoBehaviour {
public Animator anim;
static int Hit1 = Animator.StringToHash("Base Layer.attan");//攻擊
public AnimatorStateInfo BS;
public bool attackSwitch;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
BS = anim.GetCurrentAnimatorStateInfo(0);
if (keyboardctrl.Keyboardctrl() == 0)
{
anim.SetBool("Hit",true);
}
if (BS.nameHash == Hit1)//在執行攻擊動畫時自動把開關關閉
{
anim.SetBool("Hit", false);
}
}
void attackStart()
{
attackSwitch = true;
}
void attackEnd()
{
attackSwitch = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment