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
This commit is contained in:
slevy14
2023-04-25 10:22:38 -07:00
parent 0924a69f77
commit 34bb1be2fb
14 changed files with 990 additions and 270 deletions

View File

@@ -150,6 +150,10 @@ public class PlayerBehavior : MonoBehaviour
this.stateController.SetDeathCanvasActive(true);
Destroy(this.gameObject);
}
else if (col.tag == "spawnPoint") {
stateController.spawnPoint.GetComponent<SpawnPointBehavior>().DeactivateSpawnPoint();
col.GetComponent<SpawnPointBehavior>().ActivateSpawnPoint();
}
}
void OnTriggerExit2D(Collider2D col)

View File

@@ -0,0 +1,32 @@
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;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 964f5469a66144a7fbcc3aaa6ba45ec5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: