示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Body Part"))
     {
         CenterBodypartController centerBody = collision.transform.GetComponent <BodyPartController>().GetCenterBodyPart();
         centerBody.OnChangeCharacterToDynamic(centerBody.transform.parent);
     }
 }
示例#2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.transform.CompareTag("Body Part"))
     {
         if (_boxBody.velocity.magnitude >= _minVelocityToKill)
         {
             Debug.Log(_boxBody.velocity.magnitude);
             CenterBodypartController centerBody = collision.transform.GetComponent <BodyPartController>().GetCenterBodyPart();
             centerBody.OnCharacterDie(centerBody.transform.parent);
         }
     }
 }
示例#3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Body Part"))
        {
            BodyPartController       thisBodyPart = collision.GetComponent <BodyPartController>();
            CenterBodypartController centerBody   = thisBodyPart.GetCenterBodyPart();
            centerBody.OnCharacterDie(centerBody.transform.parent);
            thisBodyPart.ApplyForceToThisBodyPart(_parentRigidbody2D.velocity, _forceApplyToBodyPart);
        }

        if (collision.CompareTag("Bomb"))
        {
            collision.GetComponent <TNTController>().TriggerBomb();
        }
    }
 void Start()
 {
     _hasExploded    = false;
     _bodyController = gameObject.GetComponent <CenterBodypartController>();
 }