summaryrefslogtreecommitdiff
path: root/GameCode/PositionNoise.cs
blob: 07b6d8ab9c95ad7ce19db46006b1c245271d3927 (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 UnityEngine;

public class PositionNoise : CardAnimation
{
	public float amount;

	public float speed = 1f;

	private float startSeed;

	private Vector3 startPos;

	private void Start()
	{
		startPos = base.transform.localPosition;
		startSeed = Random.Range(0f, 100000f);
	}

	private void Update()
	{
		Vector2 vector = new Vector2(Mathf.PerlinNoise(startSeed + Time.unscaledTime * speed, startSeed + Time.unscaledTime * speed - 0.5f), Mathf.PerlinNoise(startSeed + Time.unscaledTime * speed, startSeed + Time.unscaledTime * speed) - 0.5f);
		base.transform.localPosition = startPos + (Vector3)vector * amount;
	}
}