second iter
This commit is contained in:
@@ -29,6 +29,8 @@ public class Character_ctrl : MonoBehaviour
|
||||
public float jumpSpeed = 8.0f;
|
||||
public float gravity = 20.0f;
|
||||
public float turnSpeed = 1.0f;
|
||||
public bombspawner bs;
|
||||
public Pukvbrane pukvbrane;
|
||||
private float timeks = 0;
|
||||
private bool passed = false;
|
||||
Vector2 camerarot = new Vector2(0, 0);
|
||||
@@ -92,6 +94,18 @@ public class Character_ctrl : MonoBehaviour
|
||||
|
||||
moveDirection *= speed;
|
||||
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
//if enabled textmeshpro disable
|
||||
if (textmeshpro.enabled)
|
||||
{
|
||||
textmeshpro.enabled = false;
|
||||
hudko.enabled = true;
|
||||
bs.StartBombs();
|
||||
pukvbrane.StartCubes();
|
||||
}
|
||||
}
|
||||
|
||||
if (characterController.isGrounded)
|
||||
{
|
||||
if (moveKeyb != Vector3.zero && !GetComponent<AudioSource>().isPlaying)
|
||||
@@ -104,12 +118,6 @@ public class Character_ctrl : MonoBehaviour
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
moveDirection.y = jumpSpeed;
|
||||
//if enabled textmeshpro disable
|
||||
if (textmeshpro.enabled)
|
||||
{
|
||||
textmeshpro.enabled = false;
|
||||
hudko.enabled = true;
|
||||
}
|
||||
//set location of sound to be the same as the character and play sound
|
||||
AudioSource.PlayClipAtPoint(jump_sound, transform.position);
|
||||
}
|
||||
|
24
Assets/Scripts/Loadintro.cs
Normal file
24
Assets/Scripts/Loadintro.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
//import scene manager
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Loadintro : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void LoadIntro(){
|
||||
SceneManager.LoadScene("Intro");
|
||||
}
|
||||
}
|
11
Assets/Scripts/Loadintro.cs.meta
Normal file
11
Assets/Scripts/Loadintro.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6fcce81ef90747d2b83ca77d3961910
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -2,13 +2,14 @@ using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Pukvbrane : MonoBehaviour
|
||||
{
|
||||
AudioSource audioSource;
|
||||
public HuDcko hudcko;
|
||||
public GameObject puk;
|
||||
public int maxcubes = 20;
|
||||
public int maxcubes = 3;
|
||||
public int collectedcubes = 0;
|
||||
|
||||
|
||||
@@ -17,7 +18,7 @@ public class Pukvbrane : MonoBehaviour
|
||||
int z = Random.Range(-950, 950);
|
||||
int y = -55;
|
||||
//pick y from either -75 and 845
|
||||
if (Random.Range(0, 2) == 0)
|
||||
if (Random.Range(0, 3) == 0)
|
||||
{
|
||||
y = 880;
|
||||
}
|
||||
@@ -28,6 +29,8 @@ public class Pukvbrane : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
public void StartCubes(){
|
||||
PlaceObj();
|
||||
}
|
||||
|
||||
@@ -43,13 +46,15 @@ public class Pukvbrane : MonoBehaviour
|
||||
collectedcubes++;
|
||||
PlaceObj();
|
||||
}
|
||||
else{
|
||||
if (collectedcubes == maxcubes){
|
||||
hudcko.won = true;
|
||||
SceneManager.LoadScene("End");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void Update() {
|
||||
hudcko.collectedcubes = collectedcubes;
|
||||
hudcko.collectedcubes_max = maxcubes;
|
||||
}
|
||||
|
||||
}
|
@@ -7,19 +7,14 @@ public class bombspawner : MonoBehaviour
|
||||
|
||||
public GameObject totok;
|
||||
public int maxcubes = 100;
|
||||
void PlaceObj(){
|
||||
public void PlaceObj(){
|
||||
int x = Random.Range(-821, 1000);
|
||||
int z = Random.Range(-950, 950);
|
||||
int y = 800;
|
||||
//pick y from either -75 and 845
|
||||
if (Random.Range(0, 2) == 0)
|
||||
{
|
||||
y = 1600;
|
||||
}
|
||||
int y = Random.Range(-120, 1680);
|
||||
GameObject iks = Instantiate(totok.gameObject, new Vector3(x, y, z), Quaternion.identity);
|
||||
iks.SetActive(true);
|
||||
} // Start is called before the first frame update
|
||||
void Start()
|
||||
public void StartBombs()
|
||||
{
|
||||
for (int i = 0; i < maxcubes; i++)
|
||||
{
|
||||
|
81
Assets/Scripts/destroy_level_explosion.cs
Normal file
81
Assets/Scripts/destroy_level_explosion.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class destroy_level_explosion : MonoBehaviour
|
||||
{
|
||||
public BoxCollider box1;
|
||||
public BoxCollider box2;
|
||||
public BoxCollider box3;
|
||||
public BoxCollider box4;
|
||||
public BoxCollider box5;
|
||||
public BoxCollider box6;
|
||||
public BoxCollider box7;
|
||||
public Rigidbody rb1;
|
||||
public Rigidbody rb2;
|
||||
public Rigidbody rb3;
|
||||
public Rigidbody rb4;
|
||||
public Rigidbody rb5;
|
||||
public Rigidbody rb6;
|
||||
public Rigidbody rb7;
|
||||
|
||||
public ParticleSystem explosion;
|
||||
public Transform[] explosion_pos;
|
||||
//particle systems array
|
||||
BoxCollider[] box_array;
|
||||
Rigidbody[] rb_array;
|
||||
//audio clip for explosion
|
||||
|
||||
public GameObject explosion_sound;
|
||||
|
||||
IEnumerator Detonatetrain(){
|
||||
//play explosion sound
|
||||
for (int i = 0; i < explosion_pos.Length; i++)
|
||||
{
|
||||
//instantiate explosion at each position
|
||||
GameObject asx = Instantiate(explosion_sound, explosion_pos[i].position, explosion_pos[i].rotation);
|
||||
//play explosion sound
|
||||
asx.GetComponent<AudioSource>().Play();
|
||||
ParticleSystem explosion_clone = Instantiate(explosion, explosion_pos[i].position, explosion_pos[i].rotation) as ParticleSystem;
|
||||
explosion_clone.Play();
|
||||
//wait 2 seconds
|
||||
yield return new WaitForSeconds(2);
|
||||
//destroy explosion
|
||||
Destroy(explosion_clone.gameObject);
|
||||
box_array[i].enabled = false;
|
||||
rb_array[i].isKinematic = false;
|
||||
rb_array[i].useGravity = true;
|
||||
//remove constraints
|
||||
rb_array[i].constraints = RigidbodyConstraints.None;
|
||||
//add random force to each box
|
||||
rb_array[i].AddForce(new Vector3(Random.Range(-100, 100), Random.Range(-100, 100), -400), ForceMode.Impulse);
|
||||
}
|
||||
yield return new WaitForSeconds(4);
|
||||
SceneManager.LoadScene("Finish");
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
rb_array = new Rigidbody[] { rb1, rb2, rb3, rb4, rb5, rb6, rb7 };
|
||||
box_array = new BoxCollider[]{box1, box2, box3, box4, box5, box6, box7};
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
void OnCollisionEnter(Collision other) {
|
||||
MeshRenderer mesh = this.GetComponent<MeshRenderer>();
|
||||
BoxCollider box = this.GetComponent<BoxCollider>();
|
||||
Rigidbody rb = this.GetComponent<Rigidbody>();
|
||||
TrailRenderer trail = this.GetComponent<TrailRenderer>();
|
||||
trail.enabled = false;
|
||||
mesh.enabled = false;
|
||||
box.enabled = false;
|
||||
rb.isKinematic = true;
|
||||
StartCoroutine(Detonatetrain());
|
||||
}
|
||||
}
|
11
Assets/Scripts/destroy_level_explosion.cs.meta
Normal file
11
Assets/Scripts/destroy_level_explosion.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2edaf977c02d68f0bae17b41089bd118
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/loadGameAftexsecs.cs
Normal file
26
Assets/Scripts/loadGameAftexsecs.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class loadGameAftexsecs : MonoBehaviour
|
||||
{
|
||||
public int secondsToWait = 5;
|
||||
// Start is called before the first frame update
|
||||
IEnumerator Startx()
|
||||
{
|
||||
yield return new WaitForSeconds(secondsToWait);
|
||||
SceneManager.LoadScene("Game");
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
//start coroutine
|
||||
StartCoroutine(Startx());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/loadGameAftexsecs.cs.meta
Normal file
11
Assets/Scripts/loadGameAftexsecs.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32e50f957fd2673f8a1375af598a2897
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -7,18 +7,8 @@ public class yolo : MonoBehaviour
|
||||
public Pukvbrane pukvbrane;
|
||||
|
||||
public GameObject totok;
|
||||
void PlaceObj(){
|
||||
int x = Random.Range(-821, 1000);
|
||||
int z = Random.Range(-950, 950);
|
||||
int y = 800;
|
||||
//pick y from either -75 and 845
|
||||
if (Random.Range(0, 2) == 0)
|
||||
{
|
||||
y = 1600;
|
||||
}
|
||||
GameObject iks = Instantiate(totok.gameObject, new Vector3(x, y, z), Quaternion.identity);
|
||||
iks.SetActive(true);
|
||||
}
|
||||
public bombspawner bs;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -38,7 +28,7 @@ public class yolo : MonoBehaviour
|
||||
Destroy(other.gameObject);
|
||||
pukvbrane.PlaceObj();
|
||||
}
|
||||
PlaceObj();
|
||||
bs.PlaceObj();
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user