Exemple #1
0
 public void ThrowKunai(Animator anim, Rigidbody2D body, GameObject projective, Transform firingPoint, int adjustment)
 {
     if (anim.GetBool("grounded"))
     {
         anim.Play("Throw");
     }
     else
     {
         anim.Play("JumpThrow");
     }
     projective.GetComponent <KunaiThrowController>().thrower = this;
     Instantiate(projective, firingPoint.position, firingPoint.rotation);
     KunaiManager.AddNumbers(adjustment);
 }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D target)
    {
        if (target.GetComponent <PlayerController>() == null)
        {
            return;
        }
        KunaiManager.AddNumbers(number);

        //pick up sound
        if (target.GetComponent <AudioSource>().isPlaying)
        {
            target.GetComponent <AudioSource>().Stop();
        }
        target.GetComponent <AudioSource>().PlayOneShot(pickupSound);
        if (!isDropped)
        {
            Enable(false);
        }
        else
        {
            Destroy(gameObject);
        }
    }