Created
May 27, 2019 06:57
-
-
Save IshidaGames/1ada07437390a5e5af07eec3e5926b53 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 UseSword : MonoBehaviour { | |
Animation anim; | |
CapsuleCollider capsule; | |
void Start () { | |
anim = GetComponent<Animation>(); | |
capsule = GetComponent<CapsuleCollider>(); | |
capsule.enabled = false; | |
anim.Play("NormalSword"); | |
} | |
void Update () { | |
if (Input.GetMouseButtonDown(0)) | |
{ | |
anim.Play("SwingSword"); | |
} | |
} | |
public void SwingStart() | |
{ | |
capsule.enabled = true; | |
} | |
public void SwingEnd() | |
{ | |
anim.Play("NormalSword"); | |
capsule.enabled = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment