Exemplo n.º 1
0
    protected virtual void OnCollisionEnter2D(Collision2D collision)
    {
        if (impactSound != null)
        {
            AudioSource.PlayClipAtPoint(impactSound, transform.position);
        }

        if (!isLanded)
        {
            isLanded = true;
            if (collision.gameObject.tag == "Player")
            {
                GameObject player = collision.gameObject;
                player.GetComponent <Health>().ModifyHealth(-damage);
                player.GetComponent <Health>().Hit();
            }
            Instantiate(effectPrefab, transform.position, transform.rotation);
            gamePhase.GoToNextTurn();
        }
        Destroy(gameObject);
    }
Exemplo n.º 2
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     gamePhase         = FindObjectOfType <GamePhase>();
     playerThatUseThis = gamePhase.playerThatIsInTurn;
     gamePhase.GoToNextTurn();
 }