public void DoWall() { // check if another wall if (currentWall != null) return; // Can't create two walls at the same time! playerEnergy.gameObject.GetComponent<SymbiotState>().WallUp = true; transform.parent.gameObject.GetComponent<GolemAudio>().Wall(); // Create and store wall GameObject wall = GameObject.Instantiate(prefab_golemWall, wallSpawn.position, wallSpawn.rotation) as GameObject; currentWall = wall.GetComponent<GolemWall>(); currentWall.onDestroy += ClearWallOnDestroy; }
private void ClearWallOnDestroy() { currentWall.onDestroy -= ClearWallOnDestroy; // Clear event currentWall = null; }