Skip to content

Instantly share code, notes, and snippets.

@IshidaGames
Created May 27, 2019 06:57
Show Gist options
  • Save IshidaGames/1ada07437390a5e5af07eec3e5926b53 to your computer and use it in GitHub Desktop.
Save IshidaGames/1ada07437390a5e5af07eec3e5926b53 to your computer and use it in GitHub Desktop.
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