3de471ecd7
PLEASE launch game from the main menu scene, otherwise persistent data will not load correctly
39 lines
1008 B
C#
39 lines
1008 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;
|
|
private StateController stateController;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
_sr = this.gameObject.GetComponent<SpriteRenderer>();
|
|
stateController = GameObject.Find("StateController").GetComponent<StateController>();
|
|
if (firstSpawnPoint) {
|
|
ActivateSpawnPoint();
|
|
}
|
|
}
|
|
|
|
public void ActivateSpawnPoint() {
|
|
_sr.sprite = activatedSprite;
|
|
stateController.spawnPoint = this.gameObject;
|
|
}
|
|
|
|
public void DeactivateSpawnPoint() {
|
|
_sr.sprite = deactivatedSprite;
|
|
}
|
|
}
|