created victory object and level progression
also tried to create a way to launch the game from any scene, but it doesn't really work. don't use anything in the folder called "DEBUG"
This commit is contained in:
30
Assets/Scripts/VictoryObjectBehavior.cs
Normal file
30
Assets/Scripts/VictoryObjectBehavior.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VictoryObjectBehavior : MonoBehaviour
|
||||
{
|
||||
public float height = 1f;
|
||||
public float speed = 1f;
|
||||
Vector2 initPosition;
|
||||
|
||||
void Awake() {
|
||||
initPosition = this.transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = new Vector2(initPosition.x, initPosition.y + Mathf.Sin(Time.time * speed) * height);
|
||||
}
|
||||
|
||||
void OnDrawGizmos() {
|
||||
Gizmos.DrawLine(new Vector3(transform.position.x, transform.position.y - height, transform.position.z), new Vector3(transform.position.x, transform.position.y + height, transform.position.z));
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col) {
|
||||
if (col.tag == "Player") {
|
||||
GameObject.FindGameObjectWithTag("StateController").GetComponent<StateController>().ShowVictoryCanvas();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user