change depricated method usage
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SpawnManager : MonoBehaviour
|
||||
{
|
||||
@@ -9,8 +10,8 @@ public class SpawnManager : MonoBehaviour
|
||||
|
||||
public GameObject DefaultPlayer;
|
||||
|
||||
private Transform defaultPoint;
|
||||
private Vector3 spawnLocation;
|
||||
private Transform _defaultPoint;
|
||||
private Vector3 _spawnLocation;
|
||||
private bool setPoint;
|
||||
|
||||
private void Awake()
|
||||
@@ -22,26 +23,31 @@ public class SpawnManager : MonoBehaviour
|
||||
}
|
||||
else
|
||||
Destroy(gameObject);
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SceneManager.sceneLoaded += SceneLoaded;
|
||||
|
||||
}
|
||||
|
||||
private void SetSpawn(Vector3 spawn)
|
||||
{
|
||||
spawnLocation = spawn;
|
||||
_spawnLocation = spawn;
|
||||
setPoint = true;
|
||||
}
|
||||
|
||||
private void OnLevelWasLoaded(int level)
|
||||
private void SceneLoaded(Scene arg0, LoadSceneMode arg1)
|
||||
{
|
||||
print(spawnLocation);
|
||||
if(level>1)
|
||||
print(_spawnLocation);
|
||||
if(arg0.buildIndex > 1)
|
||||
{
|
||||
var temp = GameObject.Find("SpawnHere").transform;
|
||||
DefaultPlayer.transform.position = temp.position;
|
||||
//Instantiate(DefaultPlayer, temp.position, Quaternion.identity);
|
||||
//DefaultPlayer.SetActive(true);
|
||||
}
|
||||
if(level==1)
|
||||
if(arg0.buildIndex == 1)
|
||||
{
|
||||
if (!setPoint)
|
||||
{
|
||||
@@ -57,15 +63,13 @@ public class SpawnManager : MonoBehaviour
|
||||
private void SpawnAtSetLocation()
|
||||
{
|
||||
print("Spawn at set location");
|
||||
//Instantiate(DefaultPlayer, spawnLocation, Quaternion.identity);
|
||||
DefaultPlayer.transform.position = spawnLocation;
|
||||
DefaultPlayer.transform.position = _spawnLocation;
|
||||
setPoint = false;
|
||||
}
|
||||
|
||||
private void SpawnAtStart()
|
||||
{
|
||||
defaultPoint = GameObject.Find("DefaultPoint").transform;
|
||||
DefaultPlayer.transform.position = defaultPoint.position;
|
||||
//Instantiate(DefaultPlayer, defaultPoint.position, Quaternion.identity);
|
||||
_defaultPoint = GameObject.Find("DefaultPoint").transform;
|
||||
DefaultPlayer.transform.position = _defaultPoint.position;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user