Created
February 24, 2018 07:46
-
-
Save ray5527880/d92ff83d253e785de2143bfa48feba4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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