Ein bissl mit Tweeeeeen experimentiert
This commit is contained in:
76
Assets/Scripts/Button Functions/DevScript.cs
Normal file
76
Assets/Scripts/Button Functions/DevScript.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user