コード例 #1
0
ファイル: DeathTest.cs プロジェクト: DmitrySar/unityLessons
    public void getLivesCountAfterAddLife()
    {
        Death death             = new Death();
        int   currentLivesCount = death.getLivesCount();

        death.addLivesCount();
        Assert.AreEqual(currentLivesCount++, death.getLivesCount());
    }
コード例 #2
0
 //обрабатываем взаимодействие с игроком
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         Death player = collision.gameObject.GetComponent <Death>();
         player.addLivesCount();
         Destroy(gameObject);
     }
 }