Skip to content

Instantly share code, notes, and snippets.

@bibinba
Created March 4, 2018 11:38
Show Gist options
  • Save bibinba/7bee02afb187fadced26d44b147d6252 to your computer and use it in GitHub Desktop.
Save bibinba/7bee02afb187fadced26d44b147d6252 to your computer and use it in GitHub Desktop.
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