76 lines
1.7 KiB
C#
76 lines
1.7 KiB
C#
using JetBrains.Annotations;
|
||
using Unity.VisualScripting;
|
||
using UnityEditor.Experimental.GraphView;
|
||
using UnityEngine;
|
||
using UnityEngine.LowLevelPhysics;
|
||
using UnityEngine.UIElements;
|
||
|
||
public class DevScript : MonoBehaviour
|
||
{
|
||
|
||
//GetKeyDown. = Once on press
|
||
//GetKey. = Continously until press stops
|
||
|
||
|
||
[SerializeField] private float duration;
|
||
[SerializeField] private GameObject zeObject;
|
||
[SerializeField] private GameObject button;
|
||
[SerializeField] private GameObject circle;
|
||
|
||
//private KeyCode secretCode = KeyCode.G;
|
||
|
||
Vector3 ort = new Vector3();
|
||
|
||
private void Update()
|
||
{
|
||
if (Input.GetKeyDown(KeyCode.Space))
|
||
{
|
||
Debug.Log("Hast mich gedrückt, okay. Chill mal.");
|
||
Scale();
|
||
Bounce();
|
||
Move();
|
||
}
|
||
}
|
||
|
||
//private void OnMouseDown()
|
||
//{
|
||
// Scale();
|
||
//}
|
||
|
||
//current duration set: 5
|
||
|
||
public void Scale()
|
||
{
|
||
LeanTween.scale(zeObject, transform.localScale * 1.4f, duration * Time.deltaTime).setOnComplete(Debugging);
|
||
//LeanTween.scale(Trinagle, new Vector3(2,2,2), duration).setOnComplete(Debug.Log);
|
||
}
|
||
|
||
private void Move()
|
||
{
|
||
LeanTween.moveX(button, button.transform.position.y, duration * Time.deltaTime);
|
||
}
|
||
|
||
public void Bounce()
|
||
{
|
||
//code folgt
|
||
|
||
//mach circle bounce on space press
|
||
}
|
||
|
||
void Debugging()
|
||
{
|
||
Debug.Log("I´ve scaled up.");
|
||
}
|
||
|
||
}
|
||
//LEANTWEEN Tutorial
|
||
|
||
// LeanTween.TweenFunction(P1 Parameter1, P2 Parameter2, P3 Zeitangabe).setDelay(time)
|
||
// .setOnComplete(Function)
|
||
// Function()
|
||
// {
|
||
//
|
||
// }
|
||
|
||
//Objekt bewegt sich in eine Richting
|
||
// LeanTween.moveX(gameObject, targetTransform.position.x, duration); |