blob: 8d9f722aef31aece5aec25c207196134d1d594dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using UnityEngine;
public class TumbleBoxBehaviour : MonoBehaviour
{
public FloatRange BoxHeight;
public FloatRange shadowScale;
public SpriteRenderer Shadow;
public SpriteRenderer Box;
public void FixedUpdate()
{
float z = Time.time * 15f;
float v = Mathf.Cos(Time.time * 3.1415927f / 10f) / 2f + 0.5f;
float num = this.shadowScale.Lerp(v);
this.Shadow.transform.localScale = new Vector3(num, num, num);
float y = this.BoxHeight.Lerp(v);
this.Box.transform.localPosition = new Vector3(0f, y, -0.01f);
this.Box.transform.eulerAngles = new Vector3(0f, 0f, z);
}
}
|