Implemented all needed to get a portal working to floor level as well as setting up portals for future game modes

This commit is contained in:
Gregory Campbell
2020-01-11 15:55:01 -05:00
parent 2b6eb87127
commit 31b81f08b9
7 changed files with 1605 additions and 12 deletions
+9 -4
View File
@@ -8,13 +8,18 @@ using UnityEngine.SceneManagement;
public class FloorLevel : MonoBehaviour
{
public int escalation;
public int escalation = 1;
public GameObject player;
public PlayerController script;
public GameObject[] obstacleList;
private int selection = 0;
void Awake()
{
script.respawnTime = Time.time;
}
// Start is called before the first frame update
void Start()
{
@@ -82,13 +87,13 @@ public class FloorLevel : MonoBehaviour
Instantiate(obstacleList[selection], new Vector3(50*i, 2, 50*j), Quaternion.identity);
selection = Random.Range(2, obstacleList.Length);
Instantiate(obstacleList[selection], new Vector3(-50*i, 3, -50*j), Quaternion.identity);
Instantiate(obstacleList[selection], new Vector3(-50*i, 2, -50*j), Quaternion.identity);
selection = Random.Range(2, obstacleList.Length);
Instantiate(obstacleList[selection], new Vector3(-50*i, 4, 50*j), Quaternion.identity);
Instantiate(obstacleList[selection], new Vector3(-50*i, 2, 50*j), Quaternion.identity);
selection = Random.Range(2, obstacleList.Length);
Instantiate(obstacleList[selection], new Vector3(50*i, 5, -50*j), Quaternion.identity);
Instantiate(obstacleList[selection], new Vector3(50*i, 2, -50*j), Quaternion.identity);
script.transform.position = new Vector3((50*escalation)+100, 2, (50*escalation)+100);
script.transform.Rotate(0.0f, 0.0f, 0.0f, Space.Self);
+9 -1
View File
@@ -45,7 +45,7 @@ public class PlayerController : MonoBehaviour
float slideTime = 0.0f;
float wallRunTime = 0.0f;
float respawnTime = 1.0f;
public float respawnTime = 0.0f;
float oneSec = 1.0f;
float halfSec = 0.5f;
float quarterSec = 0.25f;
@@ -81,6 +81,12 @@ public class PlayerController : MonoBehaviour
finished = true;
respawnTime = Time.time;
}
if(hit.gameObject.tag == "Obstacle Portal")
{
SceneManager.LoadScene("Floor Level", LoadSceneMode.Single);
respawnTime = Time.time;
}
}
@@ -290,6 +296,8 @@ public class PlayerController : MonoBehaviour
velocity.z = velocity.z * Mathf.Abs(moveDirection.y);
}
Debug.Log(transform.position);
// Move the controller
if((finished == false || respawn == false) && respawnTime + tenthSec < Time.time)
{