コード例 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         PlayerModel.ChangeHealth(-0.5f);
     }
 }
コード例 #2
0
 protected virtual void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         isInContact = true;
         PlayerModel.ChangeHealth(-0.5f);
     }
 }
コード例 #3
0
    public void UseFirstAidKit()
    {
        if (PlayerModel.AvailableFirstAidKits <= 0)
        {
            return;
        }

        PlayerModel.ChangeHealth(PlayerModel.FirstAidKitRegeneration);
    }
コード例 #4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         PlayerModel.ChangeHealth(-0.5f);
         CreateVatOfAcid();
     }
     if (collision.gameObject.CompareTag("Wall"))
     {
         Destroy(gameObject);
     }
 }
コード例 #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("BasicEnemy"))
     {
         collision.gameObject.GetComponent <BasicEnemyAi>().ChangeEnemyHealth(-PlayerModel.Damage);
     }
     if (collision.gameObject.CompareTag("SpittingEnemy"))
     {
         collision.gameObject.GetComponent <SpittingEnemyAi>().ChangeEnemyHealth(-PlayerModel.Damage);
     }
     if (collision.gameObject.CompareTag("Boomer"))
     {
         collision.gameObject.GetComponent <BoomerAi>().ChangeEnemyHealth(-PlayerModel.Damage);
     }
     if (collision.gameObject.CompareTag("TrailEnemy"))
     {
         collision.gameObject.GetComponent <TrailEnemyAi>().ChangeEnemyHealth(-PlayerModel.Damage);
     }
     if (collision.gameObject.CompareTag("Player"))
     {
         PlayerModel.ChangeHealth(-0.5f);
     }
 }