init
This commit is contained in:
commit
9afd57306d
323 changed files with 204673 additions and 0 deletions
50
Assets/Scripts/Game08/Game08.cs
Normal file
50
Assets/Scripts/Game08/Game08.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Game08 : MonoBehaviour{
|
||||
|
||||
public Transform target;
|
||||
public float speed;
|
||||
bool canMove = true;
|
||||
Vector3 start, end;
|
||||
int buttonsPressed;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
if (target != null){
|
||||
target.parent = null;
|
||||
start = transform.position;
|
||||
end = target.position;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate(){
|
||||
if (target != null){
|
||||
if (canMove){
|
||||
float fixedSpeed = speed * Time.fixedDeltaTime;
|
||||
transform.position = Vector3.MoveTowards(transform.position, target.position, fixedSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
if (transform.position == target.position){
|
||||
target.position = (target.position == start) ? end : start;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerStay2D(Collider2D col){
|
||||
if (Input.GetKeyDown(KeyCode.Space)){
|
||||
if(buttonsPressed < 3){
|
||||
if(buttonsPressed == 2){
|
||||
FindObjectOfType<GameController>().CompleteLevel();
|
||||
buttonsPressed += 1;
|
||||
col.enabled = false;
|
||||
}else{
|
||||
buttonsPressed += 1;
|
||||
col.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Game08/Game08.cs.meta
Normal file
11
Assets/Scripts/Game08/Game08.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 49d2bab563b331e49a0b136019ae0f99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/Game08/Game08Button.cs
Normal file
26
Assets/Scripts/Game08/Game08Button.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Game08Button : MonoBehaviour{
|
||||
|
||||
public GameObject unpressed;
|
||||
public GameObject pressed;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
|
||||
}
|
||||
|
||||
void OnTriggerStay2D(Collider2D col){
|
||||
if (Input.GetKeyDown(KeyCode.Space)){
|
||||
pressed.SetActive(true);
|
||||
unpressed.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Game08/Game08Button.cs.meta
Normal file
11
Assets/Scripts/Game08/Game08Button.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ca23f0c8b2ebc34da31e82d68b90df8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue