예제 #1
0
    protected virtual void Trap(Collider2D _other)
    {
        SetSpeed0();
        _other.tag = "Untagged";
        ItemScript item = _other.GetComponent <ItemScript> ();

        GameController.audioSource.PlayOneShot(item.collideSFX);
        item.GetComponent <Animator> ().SetBool("Hit", true);
    }
예제 #2
0
 void CollideInjur(ItemScript item, bool itemAct = false)
 {
     available = false;
     GetComponent <Animator> ().SetTrigger("Hurt");
     GameController.audioSource.PlayOneShot(hurt);
     timer = sleepTime;
     SetSpeed0();
     if (itemAct)
     {
         GameController.audioSource.PlayOneShot(item.collideSFX);
         item.GetComponent <Animator> ().SetBool("Hit", true);
     }
 }
예제 #3
0
 void Collide(ItemScript item, bool itemAct = false)
 {
     available = false;
     GetComponent <Collider2D> ().enabled = false;
     GetComponent <Animator> ().SetTrigger("Collided");
     GameController.audioSource.PlayOneShot(die);
     SetSpeed0();
     ++item.kills;
     if (itemAct)
     {
         GameController.audioSource.PlayOneShot(item.collideSFX);
         item.GetComponent <Animator> ().SetBool("Hit", true);
     }
     GameController.audioSource.GetComponent <GameController> ().CheckWin(transform.position);
     Instantiate(
         Resources.Load <GameObject> ("Splat")
         , Camera.main.WorldToScreenPoint(transform.position)
         , Quaternion.identity
         , GameObject.Find("Canvas").transform
         ).GetComponent <UnityEngine.UI.Image> ().color = color;
 }