added new prefabs, added scene load manager
This commit is contained in:
@@ -6,8 +6,11 @@ public class CameraSystem : MonoBehaviour
|
||||
[SerializeField]
|
||||
private CinemachineVirtualCamera _camera;
|
||||
|
||||
private const float _rotateSpeed = 300f;
|
||||
void Update()
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//_camera.LookAt = Player.Instance.transform;
|
||||
//_camera.Follow= Player.Instance.transform;
|
||||
//_camera.m_Follow.transform.localPosition=new Vector3(0,9,-4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class Player : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpawnManager : MonoBehaviour
|
||||
{
|
||||
public static SpawnManager Instance { get; private set; }
|
||||
|
||||
public GameObject DefaultPlayer;
|
||||
|
||||
private Transform defaultPoint;
|
||||
private Vector3 spawnLocation;
|
||||
private bool setPoint;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
else
|
||||
Destroy(gameObject);
|
||||
|
||||
}
|
||||
|
||||
private void SetSpawn(Vector3 spawn)
|
||||
{
|
||||
spawnLocation = spawn;
|
||||
setPoint = true;
|
||||
}
|
||||
|
||||
private void OnLevelWasLoaded(int level)
|
||||
{
|
||||
print(spawnLocation);
|
||||
if(level>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 (!setPoint)
|
||||
{
|
||||
print("no default location set");
|
||||
SpawnAtStart();
|
||||
}
|
||||
else
|
||||
SpawnAtSetLocation();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnAtSetLocation()
|
||||
{
|
||||
print("Spawn at set location");
|
||||
//Instantiate(DefaultPlayer, spawnLocation, Quaternion.identity);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbd507d46c2bcc940b91fc92a2dfe513
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Startup : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32bb24701f5677f4a9ebb408a9b3cd9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user