示例#1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.tag == "Player")
     {
         Debug.Log("Collided with player");
         PlayerCollisionEvent.Raise();
     }
 }
示例#2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.tag == "Player")
     {
         Debug.Log("Collided with player");
         OnSeedCollected.Raise();
         SeedAnim.SetTrigger("OnCollected");
         GetComponent <Collider2D>().enabled = false;
     }
 }
示例#3
0
    public void OnPlayerHit()
    {
        int heartCounts = hearts.Count;

        if (hearts.Count > 0)
        {
            for (int index = heartCounts - 1; index >= 0; --index)
            {
                if (hearts[index].IsActive())
                {
                    hearts[index].enabled = false;
                    if (index == 0)
                    {
                        OnPlayerDeathEvent.Raise();
                    }
                    break;
                }
            }
        }
    }
示例#4
0
 public void OnResumeGame()
 {
     OnGameResumedEvent.Raise();
     gameObject.SetActive(false);
     PauseButton.gameObject.SetActive(true);
 }