SHADE_Y3/TempScriptsFolder/RaccoonShowcase.cs

39 lines
1.3 KiB
C#

using SHADE;
using System;
public class RaccoonShowcase : Script
{
[SerializeField]
[Tooltip("Speed of the rotation in radians per second.")]
[Range(-1.0f, 2.0f)]
private double RotateSpeed = 1.0;
//[SerializeField]
//[Range(-5, 20)]
//private int test = 5;
[SerializeField]
[Tooltip("Speed of the scaling in radians per second around each axis.")]
private Vector3 ScaleSpeed = new Vector3(1.0, 1.0, 0.0);
private Transform Transform;
private double rotation = 0.0;
private Vector3 scale = Vector3.Zero;
private double originalScale = 1.0f;
public RaccoonShowcase(GameObject gameObj) : base(gameObj) {}
protected override void awake()
{
Transform = GetComponent<Transform>();
if (Transform == null)
{
Debug.LogError("Transform is NULL!");
}
originalScale = Transform.LocalScale.z;
}
protected override void update()
{
rotation += RotateSpeed * 0.16;
scale += ScaleSpeed * 0.16;
Transform.LocalRotation = new Vector3(0.0f, rotation, 0.0f);
Transform.LocalScale = new Vector3(System.Math.Abs(System.Math.Sin(scale.x)) * originalScale, System.Math.Abs(System.Math.Cos(scale.y)) * originalScale, System.Math.Abs(System.Math.Sin(scale.z)) * originalScale);
}
}