공부/C#15 스크립트에 변수가 많을 시 어떻게 정리할 것인가? - class 사용 정리 아이디어 정리 현재 개발중인 유니티 TPS조작의 스크립트중 변수명이 있는 부분이다public class PlayerMovement : MonoBehaviour{ private float _horizontal; private float _vertical; private float _mouseX; private bool _mouseLeft; private bool _canMove = true; private Animator _animator; public float moveSpeed = 10f; public float viewSpeed = 50f; public Vector3 cameraOffset; public bool isAiming = false; publ.. 2024. 11. 26. C# 공부(12) 111~124(Part3 End && C# 언어 공부 End) 111. SortedList와 SortedListusing System; using System.Collections.Generic; namespace P111 { class Program { static void Main(string[] args) { SortedList s1 = new SortedList(); s1.Add(3, "C"); s1.Add(4, "D"); s1.Add(1, "A"); s1.Add(2, "B"); for (int i = 0; i Console.WriteLine(); .. 2024. 8. 28. C# 공부(11) 101~110 101. 큐를 이용한 프로그램class Program { static void Main() { Random r = new Random(); Queue queue = new Queue(); for (int i = 0; i { queue.Enqueue(r.Next(100) / 100.0f); } queue.Print(); for (int i = 0; i { queue.Dequeue(); queue.Print(); } } } 결과0.64 0.77 0.51 0.53 0.38 0.77 0.51 0.53.. 2024. 8. 27. C# 공부(10) 93~100 93. 일반화 메소드using System; namespace P93 { class Program { static void Main(string[] args) { int[] a = { 1, 2, 3 }; double[] d = { 0.1, 0.2, 0.3 }; string[] s = { "AB", "BC", "CD" }; Print(a); Print(d); Print(s); } private static void Print(T[] values) { foreach (var .. 2024. 8. 27. 이전 1 2 3 4 다음