Created
August 1, 2024 16:20
-
-
Save QRemark/c7188c75ae3025634f685081128b2ad7 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 Move : MonoBehaviour | |
| { | |
| [SerializeField] private float _speedForward; | |
| private void Update() | |
| { | |
| ChangePosition(); | |
| } | |
| private void ChangePosition() | |
| { | |
| transform.position += transform.right * _speedForward * Time.deltaTime; | |
| } | |
| } |
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 Rotate : MonoBehaviour | |
| { | |
| [SerializeField] private float _speedRotation; | |
| private void Update() | |
| { | |
| ChangeAngle(); | |
| } | |
| private void ChangeAngle() | |
| { | |
| transform.Rotate(Vector3.up, _speedRotation * Time.deltaTime); | |
| } | |
| } |
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 Scale : MonoBehaviour | |
| { | |
| [SerializeField] private float _speedScale; | |
| private void Update() | |
| { | |
| ChangeScale(); | |
| } | |
| 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