Skip to content

Instantly share code, notes, and snippets.

@QRemark
Created August 1, 2024 10:58
Show Gist options
  • Select an option

  • Save QRemark/53d9d8fa4ad22156dc05873d8d02f7ef to your computer and use it in GitHub Desktop.

Select an option

Save QRemark/53d9d8fa4ad22156dc05873d8d02f7ef to your computer and use it in GitHub Desktop.
Трансформации
using UnityEngine;
public class ComplexTransform : MonoBehaviour
{
[SerializeField] private float _speedForward;
[SerializeField] private float _speedRotation;
[SerializeField] private float _speedScale;
void Start()
{
Debug.Log("Start");
}
void Update()
{
Debug.Log("Update");
Move();
Rotate();
ChangeScale();
}
private void Move()
{
transform.position += transform.right * _speedForward * Time.deltaTime;
}
private void Rotate()
{
transform.Rotate(Vector3.up, _speedRotation * Time.deltaTime);
}
private void ChangeScale()
{
var nextScale = transform.localScale;
nextScale += Vector3.one * _speedScale * Time.deltaTime;
transform.localScale = nextScale;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment