コード例 #1
0
ファイル: Figure.cs プロジェクト: kimch2/Adventure-Game-0001
 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);
 }
コード例 #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);
        }
    }