Skip to content

Instantly share code, notes, and snippets.

@bibinba

bibinba/kill.cs

Created Mar 4, 2018
Embed
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class kill : MonoBehaviour {
public Animator death;
public ParticleSystem katana;
private int a;
// Use this for initialization
void Start () {
a = 0;
}
// Update is called once per frame
void Update () {
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "enemy")
{
katana.transform.position = other.transform.position;
katana.Play();
Debug.Log(a);
a++;
if (a < 3)
{
death.SetTrigger("hit");
}
else
{
death.SetTrigger("death");
a = 0;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment