Ejemplo n.º 1
0
 void OnCollisionStay(Collision coll)
 {
     // if (coll.gameObject.tag.Equals ("Floor")) {
     //  mFloorTouched = true;
     //  if (mAudioSource != null && HitSound != null && coll.relativeVelocity.y > .5f) {
     //      //mAudioSource.PlayOneShot (HitSound, coll.relativeVelocity.magnitude);
     //  }
     // } else {
     //  if (mAudioSource != null && HitSound != null && coll.relativeVelocity.magnitude > 2f) {
     //      //mAudioSource.PlayOneShot (HitSound, coll.relativeVelocity.magnitude);
     //  }
     // }
     if (coll.gameObject.CompareTag("Jerry") && !isEating && isJumping)
     {
         if (mAudioSource != null && CoinSound != null)
         {
             mAudioSource.PlayOneShot(CoinSound);
         }
         isJumping = false;
         dashParticle.emissionRate = 0;
         myAnimator.SetBool("isAttack", true);
         myAnimator.SetBool("isJumping", false);
         isEating                = true;
         mRigidBody.velocity     = Vector3.zero;
         myParticle.emissionRate = 10;
         followScript.RemoveObjectFromList(coll.gameObject);
         //Destroy(coll.gameObject);
         coll.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 2
0
 void DoShaking()
 {
     if (isShaking)
     {
         time += Time.deltaTime;
         if (time >= attackTime)
         {
             isAttack = true;
             myAnimator.SetBool("isAttack", isAttack);
             myParticle.SetActive(true);
             for (int i = 0; i < ratsInTrap.Count; i++)
             {
                 followScript.RemoveObjectFromList(ratsInTrap[i].gameObject);
                 Destroy(ratsInTrap[i]);
             }
             canAttack = false;
             time      = 0;
             isShaking = false;
         }
     }
 }