본문 바로가기
728x90

IT/유니티9

유니티 게임 프로그래밍 18장 예제 구현 CSVDemo using UnityEngine; using System.Collections; using System.Collections.Generic; public class CSVDemo : MonoBehaviour { public TextAsset csv; void Start () { csv = (TextAsset)Resources.Load("ExampleCSV"); CSVReader.DebugOutputGrid( CSVReader.SplitCsvGrid(csv.text) ); PlayerPrefs.SetString("Player Name", "Foobar"); } } CSVReader using UnityEngine; using System.Collections; using System.Linq.. 2021. 5. 30.
유니티 게임 프로그래밍 16장 예제 구현 BeetleControl using UnityEngine; using System.Collections; public class BeetleControl : MonoBehaviour { public Vector3 targetPos = Vector3.zero; public float MoveSpeed = 5.0f; public GameObject HitEffect; public GameObject DeadEffect; public int HP = 300; public enum BeetleState { IDLE = 0, WALK = 1, ATTACK = 2, HIT = 3, SIZE } private BeetleState state = BeetleState.IDLE; // Use this for initia.. 2021. 5. 30.
유니티 게임 프로그래밍 12장 예제 구현 Movement using UnityEngine; using System.Collections; public class Movement : MonoBehaviour { // Use this for initialization void Start () { rigidbody.AddForce(Vector3.up * 10.0f,ForceMode.Impulse); } } PickSelect using UnityEngine; using System.Collections; public class PickSelect : MonoBehaviour { // Update is called once per frame void Update () { if(Input.GetMouseButton(0)) { Ray ray = Camer.. 2021. 5. 30.
유니티 게임 프로그래밍 10장 예제 구현 BulletSprite using UnityEngine; using System.Collections; public class BulletSprite : SpriteBase { public float Speed = 10.0f; // Use this for initialization void Start () { gameObject.AddComponent(); gameObject.rigidbody.useGravity = false; gameObject.AddComponent(); gameObject.collider.isTrigger = true; } // Update is called once per frame void Update () { float moveAmount = Speed * Time.delta.. 2021. 5. 30.
유니티 게임 프로그래밍 9장 예제 구현 Log using UnityEngine; using System.Collections; public class Log : MonoBehaviour { public GUISkin skin; public int ScrollSize; private int index = 0; private Vector2 scrollPosition = Vector2.zero; private string[] logtext; public static Log logInstance; public bool ison = false; void Awake() { logInstance = this; DontDestroyOnLoad(transform.gameObject); } void Start () { if(ScrollSize == 0) { S.. 2021. 5. 30.
유니티 게임 프로그래밍 8장 예제 구현 BulletSprite using UnityEngine; using System.Collections; public class BulletSprite : SpriteBase { public float Speed = 10.0f; // Use this for initialization void Start () { gameObject.AddComponent(); gameObject.rigidbody.useGravity = false; gameObject.AddComponent(); gameObject.collider.isTrigger = true; } // Update is called once per frame void Update () { float moveAmount = Speed * Time.delta.. 2021. 5. 30.
유니티 게임 프로그래밍 6장 예제 구현 BulletSprite using UnityEngine; using System.Collections; public class BulletSprite : SpriteBase { public float Speed = 10.0f; // Use this for initialization void Start () { gameObject.AddComponent(); gameObject.rigidbody.useGravity = false; gameObject.AddComponent(); gameObject.collider.isTrigger = true; } // Update is called once per frame void Update () { float moveAmount = Speed * Time.delta.. 2021. 5. 30.
유니티 게임 프로그래밍 5장 예제 구현 BulletControl using UnityEngine; using System.Collections; public class BulletControl : MonoBehaviour { public float Speed = 20.0f; // Update is called once per frame void Update () { float moveAmt = Time.deltaTime * Speed; transform.Translate(Vector3.forward * moveAmt); if(transform.position.z > 35.0f) { Destroy(gameObject); } } } EnemyControl using UnityEngine; using System.Collections; public.. 2021. 5. 30.
유니티 게임 프로그래밍 4장 예제 구현 BulletControl using UnityEngine; using System.Collections; public class BulletControl : MonoBehaviour { public float Speed = 20.0f; // Update is called once per frame void Update () { float moveAmt = Time.deltaTime * Speed; transform.Translate(Vector3.up * moveAmt); if(transform.position.y > 7.0f) { Destroy(gameObject); } } } EnemyControl using UnityEngine; using System.Collections; public class.. 2021. 5. 30.
728x90