2021-04-15 04:25:22 +01:00
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
|
|
|
|
public class GridObject : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public float RotationSpeed;
|
|
|
|
|
public float GridOffset;
|
|
|
|
|
public float GridAttraction;
|
|
|
|
|
public float Gravity;
|
|
|
|
|
public float Drag = .1f;
|
|
|
|
|
public float LaunchDrag;
|
|
|
|
|
|
|
|
|
|
private float _timeOffset;
|
|
|
|
|
|
|
|
|
|
public Vector3 Velocity { get; set; }
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
_timeOffset = Random.value * 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2025-01-30 01:58:05 +00:00
|
|
|
var t = transform;
|
2026-06-21 09:37:54 +01:00
|
|
|
t.localRotation = Quaternion.Euler(Mathf.Sin(Time.time - _timeOffset * RotationSpeed) * 90, 0, Mathf.Cos(Time.time - _timeOffset * RotationSpeed) * 90);
|
2021-04-15 04:25:22 +01:00
|
|
|
}
|
2026-06-21 09:37:54 +01:00
|
|
|
}
|