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);
|
||||
|
||||
}
|
||||
}
|
||||
11
3d Prototyp/Assets/Scripts/Utility/SpinningSpinner.cs.meta
Normal file
11
3d Prototyp/Assets/Scripts/Utility/SpinningSpinner.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b7e9647fcf4a0b439acce6afe885ee3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user