示例#1
0
 private void OnTriggerEnter(Collider other)
 {
     UnderfootSurfaceDetector.SurfaceType surfaceType = UnderfootSurfaceDetector.GetSurfaceType(other);
     if (surfaceType != UnderfootSurfaceDetector.SurfaceType.None)
     {
         int i = 0;
         while (i < this.colliders.Count)
         {
             if (this.colliders[i] == null || this.colliders[i] == other)
             {
                 this.colliders.RemoveAt(i);
             }
             else
             {
                 i++;
             }
         }
         this.colliders.Add(other);
         this.Surface = surfaceType;
     }
     if (other.tag == UnderfootSurfaceDetector.GoreTag)
     {
         this.goreColliders.Add(other);
     }
 }
示例#2
0
 private void UpdateSurface()
 {
     if (this.colliders.Count > 0)
     {
         this.Surface = UnderfootSurfaceDetector.GetSurfaceType(this.colliders[this.colliders.Count - 1]);
     }
     else
     {
         this.Surface = UnderfootSurfaceDetector.SurfaceType.None;
     }
 }
示例#3
0
 public void OnCollisionEnter(Collision collision)
 {
     if (!this.rigidBody)
     {
         return;
     }
     if (this.flintLock)
     {
         ArrowDamage componentInChildren = base.transform.GetComponentInChildren <ArrowDamage>();
         if (componentInChildren && componentInChildren.Live)
         {
             componentInChildren.CheckHit(collision.transform.position, collision.transform, collision.collider.isTrigger, collision.collider);
         }
     }
     this.calculateDamage(collision.gameObject);
     if ((collision.gameObject.CompareTag("Tree") || collision.gameObject.CompareTag("Stick") || collision.gameObject.layer == 17 || collision.gameObject.layer == 20 || collision.gameObject.layer == 25 || UnderfootSurfaceDetector.GetSurfaceType(collision.collider) != UnderfootSurfaceDetector.SurfaceType.None) && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             this.PlayEvent(this.rockOnTree);
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
     if ((collision.gameObject.CompareTag("TerrainMain") || collision.gameObject.layer == 26) && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             if (this.rockOnGround.Length > 0)
             {
                 this.PlayEvent(this.rockOnGround);
             }
             else
             {
                 this.PlayEvent(this.rockOnTree);
             }
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
     if (collision.gameObject.CompareTag("Float") && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             if (this.rockOnGround.Length > 0)
             {
                 this.PlayEvent(this.stickHitTree);
             }
             else
             {
                 this.PlayEvent(this.rockOnTree);
             }
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
 }
示例#4
0
 private void HandleCollision(Collider collider)
 {
     if (this.rigidBody.IsSleeping())
     {
         return;
     }
     if (collider.gameObject.CompareTag("Tree") || collider.gameObject.CompareTag("TerrainMain") || collider.gameObject.layer == 17 || collider.gameObject.layer == 20 || collider.gameObject.layer == 21 || collider.gameObject.layer == 25 || collider.gameObject.layer == 26 || UnderfootSurfaceDetector.GetSurfaceType(collider) != UnderfootSurfaceDetector.SurfaceType.None)
     {
         this.TryPlaySound(this.tree);
     }
 }
示例#5
0
 public void OnCollisionEnter(Collision collision)
 {
     if (!this.rigidBody)
     {
         return;
     }
     if ((collision.gameObject.CompareTag("Tree") || collision.gameObject.CompareTag("Stick") || collision.gameObject.layer == 17 || collision.gameObject.layer == 20 || collision.gameObject.layer == 25 || UnderfootSurfaceDetector.GetSurfaceType(collision.collider) != UnderfootSurfaceDetector.SurfaceType.None) && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             this.PlayEvent(this.rockOnTree);
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
     if ((collision.gameObject.CompareTag("TerrainMain") || collision.gameObject.layer == 26) && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             if (this.rockOnGround.Length > 0)
             {
                 this.PlayEvent(this.rockOnGround);
             }
             else
             {
                 this.PlayEvent(this.rockOnTree);
             }
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
     if (collision.gameObject.CompareTag("Float") && this.rigidBody.velocity.magnitude > this.speedThreshold)
     {
         if (!this.InWater && !this.effectDelay)
         {
             if (this.rockOnGround.Length > 0)
             {
                 this.PlayEvent(this.stickHitTree);
             }
             else
             {
                 this.PlayEvent(this.rockOnTree);
             }
         }
         if (!this.soundDelay)
         {
             this.enableSound();
             this.soundDelay = true;
         }
     }
 }