ofb/Assets/Scripts/SpawnPointBehavior.cs
slevy14 a5d1116f8e created spawn point system
works by placing spawn point prefabs wherever you want them. Also created some prefabs of death zone and grapple zone objects
2023-04-27 12:27:15 -07:00

33 lines
859 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;
// 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>();
}
public void ActivateSpawnPoint() {
_sr.sprite = activatedSprite;
stateController.spawnPoint = this.gameObject;
}
public void DeactivateSpawnPoint() {
_sr.sprite = deactivatedSprite;
}
}