aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/RespawnPoint.cs
blob: 639612843c4e689503040d7de3cd040d3b8d5be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using MontanaJohns.Actors;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RespawnPoint : MonoBehaviour
{
    [SerializeField] private Sprite activatedSprite;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            collision.gameObject.GetComponent<Player>().spawnPoint = transform.position;
            gameObject.GetComponent<SpriteRenderer>().sprite = activatedSprite;
        }
    }
}