cutscene for intro done

This commit is contained in:
Glence 2023-02-28 01:57:00 +08:00
parent 79cb0f12ae
commit 380de28358
2 changed files with 890 additions and 81 deletions

View File

@ -1,5 +1,5 @@
- EID: 1 - EID: 1
Name: Canvas Name: Canvas1
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 3
Components: Components:
@ -26,7 +26,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -500, y: -1000, z: 0.5} Translate: {x: -550, y: -1000, z: 0.5}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 675, y: 1009, z: 1} Scale: {x: 675, y: 1009, z: 1}
IsActive: true IsActive: true
@ -66,7 +66,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 500, y: -1000, z: 0.300000012} Translate: {x: 550, y: -1000, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 756, y: 984, z: 1} Scale: {x: 756, y: 984, z: 1}
IsActive: true IsActive: true
@ -150,12 +150,18 @@
Scripts: Scripts:
- Type: Cutscene - Type: Cutscene
Enabled: true Enabled: true
duration: 3 duration: 2
slideSpeed: 2
cutscene1Points: 4 cutscene1Points: 4
cutscene1Pics: 10 cutscene1Pics: 10
cutscene2Points: 20
cutscene2Pics: 14
cutscene3Points: 31
cutscene3Pics: 25
canvas1: 1
canvas2: 13
canvas3: 24
- EID: 4 - EID: 4
Name: CutScene_Points Name: CutScene1Points
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 3
Components: ~ Components: ~
@ -193,3 +199,387 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 13
Name: Canvas2
IsActive: false
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 14
Name: CutScene2
IsActive: true
NumberOfChildren: 3
Components:
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 15
Name: pic1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1050, y: 250, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1768, y: 545, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120947645
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 16
Name: pic2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -300, y: -1200, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1258, y: 596, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129923341
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 17
Name: pic3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1550, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 712, y: 1028, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 133191310
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 18
Name: Background
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.699999988}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 117531460
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 19
Name: Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 50, y: 50, z: 50}
IsActive: true
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 20
Name: CutScene2Points
IsActive: true
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 21
Name: Pic1Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -50, y: 250, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 22
Name: Pic2Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -300, y: -200, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 23
Name: Pic3Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 550, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 24
Name: Canvas3
IsActive: true
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 25
Name: CutScene3
IsActive: true
NumberOfChildren: 5
Components:
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 26
Name: pic1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1375, y: 250, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 982, y: 527, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129620984
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 27
Name: pic2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 200, y: 1200, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 625, y: 579, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 119078830
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 28
Name: pic3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1700, y: 200, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 529, y: 670, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 133041695
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 35
Name: pic4
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1225, y: -200, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1299, y: 575, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 117751129
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 36
Name: pic5
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 500, y: -1275, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 866, y: 483, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 131504451
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 29
Name: Background
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.699999988}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 117531460
IsActive: true
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 30
Name: Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 50, y: 50, z: 50}
IsActive: true
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
IsActive: false
UI Component:
Canvas ID: 24
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 31
Name: CutScene3Points
IsActive: true
NumberOfChildren: 5
Components: ~
Scripts: ~
- EID: 32
Name: Pic1Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -375, y: 250, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 33
Name: Pic2Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 200, y: 200, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 34
Name: Pic3Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 700, y: 200, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 65573
Name: Pic4Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -225, y: -200, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 38
Name: Pic5Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 500, y: -275, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~

View File

@ -8,23 +8,47 @@ public class Cutscene : Script
{ {
public float duration = 3.0f; public float duration = 3.0f;
private float oldDuration = 0.0f;
private Renderable pic1aRenderable; private Renderable pic1aRenderable;
private Renderable pic1bRenderable; private Renderable pic1bRenderable;
private Renderable pic1cRenderable; private Renderable pic1cRenderable;
private Renderable pic2aRenderable;
private Renderable pic2bRenderable;
private Renderable pic2cRenderable;
private Renderable pic3aRenderable;
private Renderable pic3bRenderable;
private Renderable pic3cRenderable;
private Renderable pic3dRenderable;
private Renderable pic3eRenderable;
private Transform pic1aTran; private Transform pic1aTran;
private Transform pic1bTran; private Transform pic1bTran;
private Transform pic1cTran; private Transform pic1cTran;
private Transform pic2aTran;
private Transform pic2bTran;
private Transform pic2cTran;
private Transform pic3aTran;
private Transform pic3bTran;
private Transform pic3cTran;
private Transform pic3dTran;
private Transform pic3eTran;
private float alphaIn = 0.0f; private float alphaIn = 0.0f;
//private float alphaOut = 1.0f;
private float time = 0.0f; private float time = 0.0f;
private bool showPic1a = true; private bool showPic1a = true;
private bool showPic1b = false; private bool showPic1b = false;
private bool showPic1c = false; private bool showPic1c = false;
private bool cutsceneDone = false; private bool showPic2a = true;
public float slideSpeed = 5.0f; private bool showPic2b = false;
private bool showPic2c = false;
private bool showPic3a = true;
private bool showPic3b = false;
private bool showPic3c = false;
private bool showPic3e = false;
private bool showPic3d = false;
private bool skip = false;
public GameObject cutscene1Points; public GameObject cutscene1Points;
private List<Transform> listOfCutscene1Points; private List<Transform> listOfCutscene1Points;
@ -32,7 +56,358 @@ public class Cutscene : Script
public GameObject cutscene1Pics; public GameObject cutscene1Pics;
private List<Renderable> listOfCutscene1Pics; private List<Renderable> listOfCutscene1Pics;
public GameObject cutscene2Points;
private List<Transform> listOfCutscene2Points;
public GameObject cutscene2Pics;
private List<Renderable> listOfCutscene2Pics;
public GameObject cutscene3Points;
private List<Transform> listOfCutscene3Points;
public GameObject cutscene3Pics;
private List<Renderable> listOfCutscene3Pics;
private TextRenderable text1;
private TextRenderable text2;
private TextRenderable text3;
public GameObject canvas1;
public GameObject canvas2;
public GameObject canvas3;
private bool cutscene1Done = false;
private bool cutscene2Done = false;
private bool cutscene3Done = false;
protected override void awake() protected override void awake()
{
initCutscene1();
initCutscene2();
initCutscene3();
}
protected override void update()
{
Canvas1();
Canvas2();
Canvas3();
if (Input.GetKeyDown(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
{
skip = true;
oldDuration = duration;
duration = 0.5f;
}
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf)
{
canvas1.SetActive(false);
canvas2.SetActive(true);
duration = oldDuration;
skip = false;
}
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene2Done && canvas2.IsActiveSelf)
{
canvas2.SetActive(false);
canvas3.SetActive(true);
duration = oldDuration;
skip = false;
}
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf)
{
//change scene
}
}
private void Canvas1()
{
if (canvas1.IsActiveSelf)
{
if (showPic1a)
{
if (time < duration)
{
pic1aTran.LocalPosition = Vector3.Lerp(pic1aTran.LocalPosition, listOfCutscene1Points[0].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1aTran.LocalPosition = listOfCutscene1Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic1aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1a = false;
showPic1b = true;
time = 0;
alphaIn = 0;
}
}
if (showPic1b)
{
if (time < duration)
{
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1bTran.LocalPosition = listOfCutscene1Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic1bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1b = false;
showPic1c = true;
time = 0;
alphaIn = 0;
}
}
if (showPic1c)
{
if (time < duration)
{
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1cTran.LocalPosition = listOfCutscene1Points[2].LocalPosition;
alphaIn = 1.0f;
}
pic1cRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1c = false;
cutscene1Done = true;
text1.Enabled = true;
time = 0;
alphaIn = 0;
}
}
}
}
private void Canvas2()
{
if (canvas2.IsActiveSelf)
{
if (showPic2a)
{
if (time < duration)
{
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic2aTran.LocalPosition = listOfCutscene2Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic2aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic2a = false;
showPic2b = true;
time = 0;
alphaIn = 0;
}
}
if (showPic2b)
{
if (time < duration)
{
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic2bTran.LocalPosition = listOfCutscene2Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic2bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic2b = false;
showPic2c = true;
time = 0;
alphaIn = 0;
}
}
if (showPic2c)
{
if (time < duration)
{
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic2cTran.LocalPosition = listOfCutscene2Points[2].LocalPosition;
alphaIn = 1.0f;
}
pic2cRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic2c = false;
cutscene2Done = true;
text2.Enabled = true;
time = 0;
alphaIn = 0;
}
}
}
}
private void Canvas3()
{
if (canvas3.IsActiveSelf)
{
if (showPic3a)
{
if (time < duration)
{
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic3aTran.LocalPosition = listOfCutscene3Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic3aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3a = false;
showPic3b = true;
time = 0;
alphaIn = 0;
}
}
if (showPic3b)
{
if (time < duration)
{
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic3bTran.LocalPosition = listOfCutscene3Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic3bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3b = false;
showPic3c = true;
time = 0;
alphaIn = 0;
}
}
if (showPic3c)
{
if (time < duration)
{
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic3cTran.LocalPosition = listOfCutscene3Points[2].LocalPosition;
alphaIn = 1.0f;
}
pic3cRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3c = false;
showPic3d = true;
time = 0;
alphaIn = 0;
}
}
if (showPic3d)
{
if (time < duration)
{
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic3dTran.LocalPosition = listOfCutscene3Points[3].LocalPosition;
alphaIn = 1.0f;
}
pic3dRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3d = false;
showPic3e = true;
time = 0;
alphaIn = 0;
}
}
if (showPic3e)
{
if (time < duration)
{
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic3eTran.LocalPosition = listOfCutscene3Points[4].LocalPosition;
alphaIn = 1.0f;
}
pic3eRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3e = false;
cutscene3Done = true;
text3.Enabled = true;
time = 0;
alphaIn = 0;
}
}
}
}
private void initCutscene1()
{ {
listOfCutscene1Points = cutscene1Points.GetComponentsInChildren<Transform>().ToList(); listOfCutscene1Points = cutscene1Points.GetComponentsInChildren<Transform>().ToList();
if (listOfCutscene1Points.Count == 0) if (listOfCutscene1Points.Count == 0)
@ -46,10 +421,10 @@ public class Cutscene : Script
{ {
pic1aRenderable = listOfCutscene1Pics[0].GetComponent<Renderable>(); pic1aRenderable = listOfCutscene1Pics[0].GetComponent<Renderable>();
pic1aTran = listOfCutscene1Pics[0].GetComponent<Transform>(); pic1aTran = listOfCutscene1Pics[0].GetComponent<Transform>();
pic1aRenderable.Material.SetProperty<float>("data.alpha" , 0.0f); pic1aRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
} }
else else
Debug.LogError("PIC1 MISSING"); Debug.LogError("SCENE 1 PIC1 MISSING");
if (listOfCutscene1Pics[1]) if (listOfCutscene1Pics[1])
{ {
@ -58,7 +433,7 @@ public class Cutscene : Script
pic1bRenderable.Material.SetProperty<float>("data.alpha", 0.0f); pic1bRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
} }
else else
Debug.LogError("PIC2 MISSING"); Debug.LogError("SCENE 1 PIC2 MISSING");
if (listOfCutscene1Pics[2]) if (listOfCutscene1Pics[2])
{ {
@ -67,84 +442,128 @@ public class Cutscene : Script
pic1cRenderable.Material.SetProperty<float>("data.alpha", 0.0f); pic1cRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
} }
else else
Debug.LogError("PIC3 MISSING"); Debug.LogError("SCENE 1 PIC3 MISSING");
if (canvas1)
{
text1 = canvas1.GetComponentInChildren<TextRenderable>();
text1.Enabled = false;
}
else
Debug.LogError("Canvas 1 missing");
}
private void initCutscene2()
{
listOfCutscene2Points = cutscene2Points.GetComponentsInChildren<Transform>().ToList();
if (listOfCutscene2Points.Count == 0)
Debug.LogError("Cutscene2Points Empty");
listOfCutscene2Pics = cutscene2Pics.GetComponentsInChildren<Renderable>().ToList();
if (listOfCutscene2Pics.Count == 0)
Debug.LogError("Cutscene2Pics Empty");
if (listOfCutscene2Pics[0])
{
pic2aRenderable = listOfCutscene2Pics[0].GetComponent<Renderable>();
pic2aTran = listOfCutscene2Pics[0].GetComponent<Transform>();
pic2aRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 2 PIC1 MISSING");
if (listOfCutscene2Pics[1])
{
pic2bRenderable = listOfCutscene2Pics[1].GetComponent<Renderable>();
pic2bTran = listOfCutscene2Pics[1].GetComponent<Transform>();
pic2bRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 2 PIC2 MISSING");
if (listOfCutscene2Pics[2])
{
pic2cRenderable = listOfCutscene2Pics[2].GetComponent<Renderable>();
pic2cTran = listOfCutscene2Pics[2].GetComponent<Transform>();
pic2cRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 2 PIC3 MISSING");
if (canvas2)
{
text2 = canvas2.GetComponentInChildren<TextRenderable>();
text2.Enabled = false;
canvas2.SetActive(false);
}
else
Debug.LogError("Canvas 2 missing");
} }
protected override void update() private void initCutscene3()
{ {
listOfCutscene3Points = cutscene3Points.GetComponentsInChildren<Transform>().ToList();
if (listOfCutscene3Points.Count == 0)
Debug.LogError("Cutscene3Points Empty");
if (showPic1a) listOfCutscene3Pics = cutscene3Pics.GetComponentsInChildren<Renderable>().ToList();
if (listOfCutscene3Pics.Count == 0)
Debug.LogError("Cutscene3Pics Empty");
if (listOfCutscene3Pics[0])
{ {
pic1aTran.LocalPosition = Vector3.Lerp(pic1aTran.LocalPosition, listOfCutscene1Points[0].LocalPosition, slideSpeed * Time.DeltaTimeF); pic3aRenderable = listOfCutscene3Pics[0].GetComponent<Renderable>();
if (time < duration) pic3aTran = listOfCutscene3Pics[0].GetComponent<Transform>();
{ pic3aRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1aTran.LocalPosition = listOfCutscene1Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic1aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1a = false;
showPic1b = true;
time = 0;
alphaIn = 0;
}
} }
else
Debug.LogError("SCENE 3 PIC1 MISSING");
if (showPic1b) if (listOfCutscene3Pics[1])
{ {
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, slideSpeed * Time.DeltaTimeF); pic3bRenderable = listOfCutscene3Pics[1].GetComponent<Renderable>();
if (time < duration) pic3bTran = listOfCutscene3Pics[1].GetComponent<Transform>();
{ pic3bRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1bTran.LocalPosition = listOfCutscene1Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic1bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1b = false;
showPic1c = true;
time = 0;
alphaIn = 0;
}
} }
else
Debug.LogError("SCENE 3 PIC2 MISSING");
if (showPic1c) if (listOfCutscene3Pics[2])
{ {
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, slideSpeed * Time.DeltaTimeF); pic3cRenderable = listOfCutscene3Pics[2].GetComponent<Renderable>();
if (time < duration) pic3cTran = listOfCutscene3Pics[2].GetComponent<Transform>();
{ pic3cRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic1cTran.LocalPosition = listOfCutscene1Points[2].LocalPosition;
alphaIn = 1.0f;
}
pic1cRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1c = false;
cutsceneDone = true;
time = 0;
alphaIn = 0;
}
} }
else
Debug.LogError("SCENE 3 PIC3 MISSING");
if (listOfCutscene3Pics[3])
{
pic3dRenderable = listOfCutscene3Pics[3].GetComponent<Renderable>();
pic3dTran = listOfCutscene3Pics[3].GetComponent<Transform>();
pic3dRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 3 PIC4 MISSING");
if (listOfCutscene3Pics[4])
{
pic3eRenderable = listOfCutscene3Pics[4].GetComponent<Renderable>();
pic3eTran = listOfCutscene3Pics[4].GetComponent<Transform>();
pic3eRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 2 PIC5 MISSING");
if (canvas3)
{
text3 = canvas3.GetComponentInChildren<TextRenderable>();
text3.Enabled = false;
canvas3.SetActive(false);
}
else
Debug.LogError("Canvas 3 missing");
} }
} }