init
This commit is contained in:
commit
9afd57306d
323 changed files with 204673 additions and 0 deletions
11
Assets/Scripts/Game12/Bounce.physicsMaterial2D
Normal file
11
Assets/Scripts/Game12/Bounce.physicsMaterial2D
Normal file
|
@ -0,0 +1,11 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!62 &6200000
|
||||
PhysicsMaterial2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Bounce
|
||||
friction: 0
|
||||
bounciness: 1
|
8
Assets/Scripts/Game12/Bounce.physicsMaterial2D.meta
Normal file
8
Assets/Scripts/Game12/Bounce.physicsMaterial2D.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9555af9c9889a0f4ca4fe9fd1d1edef4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
49
Assets/Scripts/Game12/Game12Ball.cs
Normal file
49
Assets/Scripts/Game12/Game12Ball.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Game12Ball : MonoBehaviour{
|
||||
|
||||
public GameObject particles;
|
||||
public GameObject death;
|
||||
public float speed;
|
||||
public Rigidbody2D rb2d;
|
||||
bool launched;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
if(Time.timeScale > 0 && !launched){
|
||||
Launch();
|
||||
launched = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Launch(){
|
||||
float x = Random.Range(0, 2) == 0 ? -1 : 1;
|
||||
float y = Random.Range(0, 2) == 0 ? -1 : 1;
|
||||
rb2d.velocity = new Vector2(speed * x, speed * y);
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D col){
|
||||
if(col.gameObject.tag == "Finish"){
|
||||
StartCoroutine(Death());
|
||||
}else{
|
||||
AudioManager.instance.Play("Paddle");
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Death(){
|
||||
Time.timeScale = 0;
|
||||
particles.SetActive(true);
|
||||
GetComponent<SpriteRenderer>().enabled = false;
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
death.SetActive(true);
|
||||
yield return new WaitForSecondsRealtime(5f);
|
||||
FindObjectOfType<GameController>().LoseGame();
|
||||
}
|
||||
}
|
11
Assets/Scripts/Game12/Game12Ball.cs.meta
Normal file
11
Assets/Scripts/Game12/Game12Ball.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1039ac346c5a1a34b8cb4d02e5455a58
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
35
Assets/Scripts/Game12/Game12Paddle.cs
Normal file
35
Assets/Scripts/Game12/Game12Paddle.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Game12Paddle : MonoBehaviour{
|
||||
|
||||
public float speed;
|
||||
public Rigidbody2D rb1;
|
||||
public Rigidbody2D rb2;
|
||||
|
||||
float movement = 0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
if (Input.GetKeyDown(KeyCode.Space)){
|
||||
if(movement == 1){
|
||||
movement = -1;
|
||||
}else if(movement == -1){
|
||||
movement = 1;
|
||||
}else if(movement == 0){
|
||||
movement = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
rb1.velocity = new Vector2(movement * speed, rb1.velocity.y);
|
||||
rb2.velocity = new Vector2(movement * speed, rb2.velocity.y);
|
||||
}
|
||||
}
|
11
Assets/Scripts/Game12/Game12Paddle.cs.meta
Normal file
11
Assets/Scripts/Game12/Game12Paddle.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0dd60d398f3f994459516a9fa2f44aa0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue