Commit 7b41b137 authored by radow's avatar radow
Browse files

throneroom cutscene

parent 6227aa9f
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraShake : MonoBehaviour
{
public IEnumerator Shake(float duration, float magnitude)
{
Vector3 originalPostition = transform.localPosition;
float elapsed = 0;
while(elapsed < duration)
{
float x = Random.Range(-1f, 1f) * magnitude;
float y = Random.Range(-1f, 1f) * magnitude;
transform.localPosition = originalPostition + new Vector3(x, y, 0);
elapsed += Time.deltaTime;
yield return null;
}
transform.localPosition = originalPostition;
}
}
fileFormatVersion: 2
guid: db4299bdfef3536479303759776725ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Cutscene_Throne : MonoBehaviour
{
public GameObject[] players;
public GameObject[] barrels;
public GameObject[] fires;
public TextMeshProUGUI subtitles;
public Image fadescreen;
public CameraShake cam;
public AudioSource explosion;
public float nextin;
bool waiting;
bool fadeToBlack;
float duration = 2;
float progress;
void Update()
{
if (waiting && Input.GetKeyDown(KeyCode.Space)) waiting = false;
nextin -= Time.deltaTime;
if (nextin < 0 && !waiting) Next();
if (fadeToBlack)
{
progress += Time.deltaTime;
Color c = Color.black;
c.a = progress / duration;
fadescreen.color = c;
}
}
int part;
int player;
int barrel = -1;
int fire = -1;
void Next()
{
switch (part)
{
case 0:
player = 0;
nextin = 1;
break;
case 1:
player = 1;
nextin = 1;
break;
case 2:
player = 2;
nextin = 1;
break;
case 3:
player = 3;
nextin = 1;
break;
case 4:
player = 4;
nextin = 1;
subtitles.text = "The throne room! I have finally arrived. \n[Space]";
waiting = true;
break;
case 5:
player = 5;
nextin = .6f;
subtitles.text = "";
break;
case 6:
player = 5;
nextin = .4f;
barrel = 0;
break;
case 7:
player = 6;
nextin = .4f;
break;
case 8:
player = 6;
nextin = .4f;
barrel = 1;
break;
case 9:
player = 7;
nextin = .4f;
break;
case 10:
player = 7;
nextin = .4f;
barrel = 2;
break;
case 11:
player = 8;
nextin = 1;
barrel = 2;
break;
case 12:
player = 9;
nextin = 1;
barrel = 2;
break;
case 13:
player = 10;
nextin = 1;
barrel = 2;
fire = 0;
break;
case 14:
player = 11;
nextin = 1;
barrel = 2;
fire = 1;
break;
case 15:
player = 11;
nextin = 1;
barrel = 2;
fire = 2;
break;
case 16:
explosion.Play();
fadeToBlack = true;
StartCoroutine(cam.Shake(3,3));
nextin = 5;
break;
case 17:
StartCoroutine(LoadYourAsyncScene());
break;
}
//chose correct player
for(int i = 0; i<players.Length; i++)
{
players[i].SetActive(i == player);
}
for (int i = 0; i < barrels.Length; i++)
{
if(barrel == i)barrels[i].SetActive(true);
}
for (int i = 0; i < fires.Length; i++)
{
fires[i].SetActive(i == fire);
}
part++;
}
IEnumerator LoadYourAsyncScene()
{
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1, LoadSceneMode.Single);
while (!asyncLoad.isDone)
{
yield return null;
}
}
}
fileFormatVersion: 2
guid: 8e9337c5a1b378c45afa0c101d364f73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: b0ab589fd6b5da645b1b3397be7fbbd1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 51f14ac9a77e31c4bbbbfae0e7dc4cad
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: carpet
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _NORMALMAP
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: bb6859c5f9473e54faea810d8b670596, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 13.3, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 2016ff4401c6fb240854e440b1d1fd0b, type: 3}
m_Scale: {x: 13.3, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 0.35
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0.49
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.4245283, g: 0.062430624, b: 0, a: 1}
- _EmissionColor: {r: 0.7735849, g: 0.040138844, b: 0.040138844, a: 1}
m_BuildTextureStacks: []
fileFormatVersion: 2
guid: 8e99accdffd1d734f99c54fdbc7c4c82
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
This source diff could not be displayed because it is stored in LFS. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment