Bug fixes, Scene changes and new features #376

Merged
glencelow merged 15 commits from PlayerController into main 2023-02-28 23:10:33 +08:00
8 changed files with 337 additions and 12 deletions
Showing only changes of commit c912dd2e4b - Show all commits

View File

@ -4,5 +4,5 @@
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54324293 data.textureIndex: 54324293
data.alpha: 0 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

@ -4,5 +4,5 @@
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 57302694 data.textureIndex: 57302694
data.alpha: 0 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,155 @@
- EID: 1
Name: Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 10
Name: CutScene1
IsActive: true
NumberOfChildren: 3
Components:
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 2
Name: pic1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -500, y: -1000, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 500, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 65542
Name: pic2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 1000, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 500, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 123313564
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 5
Name: pic3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 500, y: -1000, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 500, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129138332
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 3
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0, z: 0}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1175
Near: 0.00999999978
Far: 10000
Perspective: true
FOV: 90
IsActive: true
Scripts: ~
- EID: 7
Name: CutsceneManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: Cutscene
Enabled: true
duration: 3
slideSpeed: 2
cutscene1Points: 4
cutscene1Pics: 10
- EID: 4
Name: CutScene_Points
IsActive: true
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 0
Name: Pic1Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -500, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 8
Name: Pic2Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 9
Name: Pic3Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 500, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: CutScene
ID: 91947920
Type: 5

View File

@ -1,7 +1,7 @@
- EID: 0 - EID: 0
Name: Canvas Name: Canvas
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 4
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -84,6 +84,26 @@
Scripts: Scripts:
- Type: QuitButton - Type: QuitButton
Enabled: true Enabled: true
- EID: 7
Name: Test
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 3.14159274}
Scale: {x: 1920, y: 500, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: true
UI Component:
Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 2 - EID: 2
Name: Light Name: Light
IsActive: true IsActive: true
@ -130,3 +150,4 @@
Enabled: true Enabled: true
sceneID: 96668835 sceneID: 96668835
obj: 1 obj: 1
test: 7

View File

@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SHADE;
public class Cutscene : Script
{
public float duration = 3.0f;
private Renderable pic1Renderable;
private Renderable pic2Renderable;
private Renderable pic3Renderable;
private Transform pic1Tran;
private Transform pic2Tran;
private Transform pic3Tran;
private float alphaIn = 0.0f;
//private float alphaOut = 1.0f;
private float time = 0.0f;
private bool showPic1 = true;
private bool showPic2 = false;
private bool showPic3 = false;
public float slideSpeed = 5.0f;
public GameObject cutscene1Points;
private List<Transform> listOfCutscene1Points;
public GameObject cutscene1Pics;
private List<Renderable> listOfCutscene1Pics;
protected override void awake()
{
listOfCutscene1Points = cutscene1Points.GetComponentsInChildren<Transform>().ToList();
if (listOfCutscene1Points.Count == 0)
Debug.LogError("Cutscene1Points Empty");
listOfCutscene1Pics = cutscene1Pics.GetComponentsInChildren<Renderable>().ToList();
if (listOfCutscene1Pics.Count == 0)
Debug.LogError("Cutscene1Pics Empty");
if (listOfCutscene1Pics[0])
{
pic1Renderable = listOfCutscene1Pics[0].GetComponent<Renderable>();
pic1Tran = listOfCutscene1Pics[0].GetComponent<Transform>();
pic1Renderable.Material.SetProperty<float>("data.alpha" , 0.0f);
}
else
Debug.LogError("PIC1 MISSING");
if (listOfCutscene1Pics[1])
{
pic2Renderable = listOfCutscene1Pics[1].GetComponent<Renderable>();
pic2Tran = listOfCutscene1Pics[1].GetComponent<Transform>();
pic2Renderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("PIC2 MISSING");
if (listOfCutscene1Pics[2])
{
pic3Renderable = listOfCutscene1Pics[2].GetComponent<Renderable>();
pic3Tran = listOfCutscene1Pics[2].GetComponent<Transform>();
pic3Renderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("PIC3 MISSING");
}
protected override void update()
{
if (showPic1)
{
pic1Tran.LocalPosition = Vector3.Lerp(pic1Tran.LocalPosition, listOfCutscene1Points[0].LocalPosition, slideSpeed * Time.DeltaTimeF);
if (time < duration)
{
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
alphaIn = 1.0f;
pic1Renderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic1 = false;
showPic2 = true;
time = 0;
alphaIn = 0;
}
}
if (showPic2)
{
pic2Tran.LocalPosition = Vector3.Lerp(pic2Tran.LocalPosition, listOfCutscene1Points[1].LocalPosition, slideSpeed * Time.DeltaTimeF);
if (time < duration)
{
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
alphaIn = 1.0f;
pic2Renderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic2 = false;
showPic3 = true;
time = 0;
alphaIn = 0;
}
}
if (showPic3)
{
pic3Tran.LocalPosition = Vector3.Lerp(pic3Tran.LocalPosition, listOfCutscene1Points[2].LocalPosition, slideSpeed * Time.DeltaTimeF);
if (time < duration)
{
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
alphaIn = 1.0f;
pic3Renderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic3 = false;
time = 0;
alphaIn = 0;
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_Cutscene
ID: 157565851
Type: 9

View File

@ -9,6 +9,10 @@ public class MainMenu : Script
public GameObject obj; public GameObject obj;
private Renderable renderable; private Renderable renderable;
//tbr
public GameObject test;
public Renderable testRenderable;
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu"); AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
@ -18,6 +22,9 @@ public class MainMenu : Script
AudioHandler.audioClipHandlers["BGMMainMenu"].Play(); AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
renderable = obj.GetComponent<Renderable>(); renderable = obj.GetComponent<Renderable>();
//tbr
testRenderable = test.GetComponent<Renderable>();
} }
protected override void start() protected override void start()
@ -27,17 +34,13 @@ public class MainMenu : Script
{ {
if (Input.GetKeyDown(Input.KeyCode.K) && obj) if (Input.GetKeyDown(Input.KeyCode.K) && obj)
{ {
if (renderable.Material.GetProperty<float>("data.alpha") == 1) if (testRenderable.Material.GetProperty<float>("data.alpha") == 1)
{ {
Debug.Log("ALPHA ZERO"); testRenderable.Material.SetProperty<float>("data.alpha", 0);
Debug.Log($"{obj.EntityId}");
obj.GetComponent<Renderable>().Material.SetProperty<float>("data.alpha", 0);
} }
else if (renderable.Material.GetProperty<float>("data.alpha") == 0) else if (testRenderable.Material.GetProperty<float>("data.alpha") == 0)
{ {
Debug.Log("ALPHA ONE"); testRenderable.Material.SetProperty<float>("data.alpha", 1);
Debug.Log($"{obj.EntityId}");
obj.GetComponent<Renderable>().Material.SetProperty<float>("data.alpha", 1);
} }
} }