Devs sprechen jetzt wenn sie was wollen
This commit is contained in:
28
3d Prototyp/Assets/Scripts/Utility/SpinningSpinner.cs
Normal file
28
3d Prototyp/Assets/Scripts/Utility/SpinningSpinner.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpinningSpinner : MonoBehaviour
|
||||
{
|
||||
public float spinningSpeed = 100.0f;
|
||||
public float hoverSpeed = 1.5f;
|
||||
public float hoverHeight = 0.1f;
|
||||
|
||||
private float originalY;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Urspr<70>ngliche Y-Position des Objekts speichern
|
||||
originalY = transform.position.y;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(0, 0, Time.deltaTime * spinningSpeed);
|
||||
float newY = originalY + (Mathf.Cos(Time.time * hoverSpeed) * hoverHeight);
|
||||
transform.position = new Vector3(transform.position.x, newY, transform.position.z);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user