40 lines
903 B
C#
40 lines
903 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SpawnPointBehavior : MonoBehaviour
|
|
{
|
|
|
|
// set in inspector
|
|
[Header("Sprites")]
|
|
[SerializeField] private Sprite deactivatedSprite;
|
|
[SerializeField] private Sprite activatedSprite;
|
|
|
|
[Header("Initialization")]
|
|
[SerializeField] public bool firstSpawnPoint;
|
|
|
|
// not set in inspector
|
|
private SpriteRenderer _sr;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
_sr = this.gameObject.GetComponent<SpriteRenderer>();
|
|
if (firstSpawnPoint)
|
|
{
|
|
ActivateSpawnPoint();
|
|
}
|
|
}
|
|
|
|
public void ActivateSpawnPoint()
|
|
{
|
|
_sr.sprite = activatedSprite;
|
|
StateController.Instance.spawnPoint = this.gameObject;
|
|
}
|
|
|
|
public void DeactivateSpawnPoint()
|
|
{
|
|
_sr.sprite = deactivatedSprite;
|
|
}
|
|
}
|