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