Cutsceeens
This commit is contained in:
49
Assets/Scripts/Intro_player.cs
Normal file
49
Assets/Scripts/Intro_player.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Intro_player : MonoBehaviour
|
||||
{
|
||||
|
||||
public Animator animator;
|
||||
public AudioSource sfx;
|
||||
public AudioSource EngineSfx;
|
||||
public ParticleSystem explosion;
|
||||
public ParticleSystem engine;
|
||||
public Rigidbody2D rb;
|
||||
|
||||
public bool crashed;
|
||||
private void OnCollisionEnter2D (Collision2D collisionInfo)
|
||||
{
|
||||
if (collisionInfo.collider.name == "Planet") {
|
||||
animator.SetBool("crashed", true);
|
||||
crashed = true;
|
||||
explosion.Play();
|
||||
sfx.Play();
|
||||
engine.Stop();
|
||||
EngineSfx.Stop();
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Vector3 targetVelocity = rb.velocity;
|
||||
if(!crashed){
|
||||
targetVelocity[0] = 12f;
|
||||
targetVelocity[1] = 0f;
|
||||
}
|
||||
else{
|
||||
targetVelocity[0] = 0f;
|
||||
targetVelocity[1] = 0f;
|
||||
StartCoroutine(Example());
|
||||
|
||||
}
|
||||
rb.velocity = targetVelocity;
|
||||
}
|
||||
IEnumerator Example()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(2);
|
||||
SceneManager.LoadScene("Tutorial");
|
||||
}
|
||||
}
|
11
Assets/Scripts/Intro_player.cs.meta
Normal file
11
Assets/Scripts/Intro_player.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6c1bdac27d30ce469e733fba929f79a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -23,7 +23,7 @@ public class MenuPlay : MonoBehaviour
|
||||
if(Physics2D.CircleCast(mouse.pos, 1f, Vector2.zero, 0f, contactFilter)){
|
||||
if (Input.GetMouseButtonDown(0)){
|
||||
sfx.Play();
|
||||
SceneManager.LoadScene("Tutorial");
|
||||
SceneManager.LoadScene("Intro");
|
||||
}
|
||||
|
||||
previous_hover = hover;
|
||||
|
57
Assets/Scripts/Outro_Player.cs
Normal file
57
Assets/Scripts/Outro_Player.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Outro_Player : MonoBehaviour
|
||||
{
|
||||
|
||||
public AudioSource enginesfx;
|
||||
public ParticleSystem engine;
|
||||
public Rigidbody2D rb;
|
||||
|
||||
public bool running = false;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(starting());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Vector3 targetVelocity = rb.velocity;
|
||||
if(running){
|
||||
targetVelocity[0] = 0f;
|
||||
targetVelocity[1] = 12f;
|
||||
}
|
||||
else{
|
||||
targetVelocity[0] = 0f;
|
||||
targetVelocity[1] = 0f;
|
||||
|
||||
|
||||
}
|
||||
rb.velocity = targetVelocity;
|
||||
}
|
||||
IEnumerator starting()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(3f);
|
||||
engine.Play();
|
||||
enginesfx.Play();
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
engine.Stop();
|
||||
enginesfx.Stop();
|
||||
yield return new WaitForSecondsRealtime(3f);
|
||||
engine.Play();
|
||||
enginesfx.Play();
|
||||
yield return new WaitForSecondsRealtime(2f);
|
||||
engine.Stop();
|
||||
enginesfx.Stop();
|
||||
yield return new WaitForSecondsRealtime(3f);
|
||||
engine.Play();
|
||||
running = true;
|
||||
enginesfx.Play();
|
||||
yield return new WaitForSecondsRealtime(5f);
|
||||
SceneManager.LoadScene("Finish");
|
||||
}
|
||||
}
|
11
Assets/Scripts/Outro_Player.cs.meta
Normal file
11
Assets/Scripts/Outro_Player.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec2edaeb6f39a1941815b5026576c858
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -69,7 +69,7 @@ public class PlayerControls : MonoBehaviour
|
||||
|
||||
}
|
||||
void FixedUpdate(){
|
||||
controller.Move(horizonatalaxis * runspeed * 10f * Time.fixedDeltaTime, jumping);
|
||||
controller.Move(horizonatalaxis * runspeed, jumping);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user