Skip to content
Snippets Groups Projects
Commit 6f85d131 authored by Ryan Hoppe (rmh898)'s avatar Ryan Hoppe (rmh898)
Browse files

Added doors to the between scene, kinda janky

parent faa59246
No related branches found
No related tags found
No related merge requests found
Showing
with 92 additions and 1 deletion
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\ArenaCombatControl.cs" /> <Compile Include="Assets\Scripts\ArenaCombatControl.cs" />
<Compile Include="Assets\Scripts\ArenaPortraits.cs" /> <Compile Include="Assets\Scripts\ArenaPortraits.cs" />
<Compile Include="Assets\Scripts\BackToMainScreen.cs" />
<Compile Include="Assets\Scripts\BananaMovement.cs" /> <Compile Include="Assets\Scripts\BananaMovement.cs" />
<Compile Include="Assets\Scripts\CameraMovement.cs" /> <Compile Include="Assets\Scripts\CameraMovement.cs" />
<Compile Include="Assets\Scripts\CurrentWeapon.cs" /> <Compile Include="Assets\Scripts\CurrentWeapon.cs" />
...@@ -54,10 +55,12 @@ ...@@ -54,10 +55,12 @@
<Compile Include="Assets\Scripts\EnemyAI.cs" /> <Compile Include="Assets\Scripts\EnemyAI.cs" />
<Compile Include="Assets\Scripts\EnemyCollision.cs" /> <Compile Include="Assets\Scripts\EnemyCollision.cs" />
<Compile Include="Assets\Scripts\EnemyHealth.cs" /> <Compile Include="Assets\Scripts\EnemyHealth.cs" />
<Compile Include="Assets\Scripts\HowToPlay.cs" />
<Compile Include="Assets\Scripts\InBetween.cs" /> <Compile Include="Assets\Scripts\InBetween.cs" />
<Compile Include="Assets\Scripts\InBetweenAI.cs" /> <Compile Include="Assets\Scripts\InBetweenAI.cs" />
<Compile Include="Assets\Scripts\InBetweenBattle.cs" /> <Compile Include="Assets\Scripts\InBetweenBattle.cs" />
<Compile Include="Assets\Scripts\InBetweenCamera.cs" /> <Compile Include="Assets\Scripts\InBetweenCamera.cs" />
<Compile Include="Assets\Scripts\InBetweenDoors.cs" />
<Compile Include="Assets\Scripts\MainMenu.cs" /> <Compile Include="Assets\Scripts\MainMenu.cs" />
<Compile Include="Assets\Scripts\PlayerCollision.cs" /> <Compile Include="Assets\Scripts\PlayerCollision.cs" />
<Compile Include="Assets\Scripts\PlayerHealth.cs" /> <Compile Include="Assets\Scripts\PlayerHealth.cs" />
......
No preview for this file type
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class InBetweenDoors : MonoBehaviour
{
public string sceneName;
public GameObject player;
public Transform[] spawnPoint;
public Text doorText;
//teleporting player when leaving back to the door they initially entered (to target)
void OnLevelWasLoaded()
{
player.transform.position = spawnPoint[EnterDoor.spawnPointIndex].position;
}
void Start()
{
}
// when creating extra doors, add spawnPoint[] in correct order in the inspector.
void OnTriggerEnter2D(Collider2D collider)
{
if (this.CompareTag("ToTown01"))
{
EnterDoor.townIndex = 1;
EnterDoor.spawnPointIndex = 0;
Debug.Log("The index is:" + EnterDoor.spawnPointIndex);
}
if (this.CompareTag("ToTown02"))
{
EnterDoor.townIndex = 2;
EnterDoor.spawnPointIndex = 1;
Debug.Log("The index is:" + EnterDoor.spawnPointIndex);
}
if (collider.CompareTag("Player") && EnterDoor.spawnPointIndex == 0)
{
doorText.text = ("Press [F] to go to Medieval Town");
if (Input.GetKeyDown("f"))
{
EnterDoor.spawnPointIndex = 4;
SceneManager.LoadScene(sceneName);
}
}
if (collider.CompareTag("Player") && EnterDoor.spawnPointIndex == 1)
{
doorText.text = ("Press [F] to go to Desert Town");
if (Input.GetKeyDown("f"))
{
EnterDoor.spawnPointIndex = 4;
SceneManager.LoadScene(sceneName);
}
}
}
void OnTriggerStay2D(Collider2D collider)
{
if (collider.tag == "Player" && EnterDoor.spawnPointIndex != 3)
{
if (Input.GetKeyDown("f"))
{
SceneManager.LoadScene(sceneName);
}
}
}
void OnTriggerExit2D(Collider2D collider)
{
if (collider.tag == "Player")
{
doorText.text = (""); // reset the "Press [F]...." text
}
}
}
fileFormatVersion: 2
guid: a14c6d1d0705af649a7c853e9cdc105d
timeCreated: 1480543631
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
No preview for this file type
sceneSetups: sceneSetups:
- path: Assets/Scenes/arena.unity - path: Assets/Scenes/Town01ToTown02.unity
isLoaded: 1 isLoaded: 1
isActive: 1 isActive: 1
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment