Created
August 1, 2024 10:58
-
-
Save QRemark/53d9d8fa4ad22156dc05873d8d02f7ef to your computer and use it in GitHub Desktop.
Трансформации
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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