2022-09-28 23:55:44 +08:00
|
|
|
using SHADE;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class RaccoonShowcase : Script
|
|
|
|
{
|
2022-10-18 20:09:50 +08:00
|
|
|
[SerializeField]
|
|
|
|
[Tooltip("Speed of the rotation in radians per second.")]
|
2022-10-18 22:34:46 +08:00
|
|
|
[Range(-1.0f, 2.0f)]
|
2022-10-18 20:09:50 +08:00
|
|
|
private double RotateSpeed = 1.0;
|
2022-10-18 22:34:46 +08:00
|
|
|
//[SerializeField]
|
|
|
|
//[Range(-5, 20)]
|
|
|
|
//private int test = 5;
|
2022-10-18 20:09:50 +08:00
|
|
|
[SerializeField]
|
|
|
|
[Tooltip("Speed of the scaling in radians per second around each axis.")]
|
|
|
|
private Vector3 ScaleSpeed = new Vector3(1.0, 1.0, 0.0);
|
2022-09-28 23:55:44 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|