Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 |
Tags
- AR
- vm instance
- UX
- Google Play Console
- google signin
- GCP
- gpgs
- RIM
- python3
- language
- Python
- c#
- smoothness
- Firebase
- 파이썬
- unity
- jackandthebeanstalk
- google play games services
- texture
- 개발
- Dot
- Specular
- BigData
- 언어
- json
- UI
- tool
- shader
- Standard
- Class
Archives
- Today
- Total
Crazy Lazy
[1일차] C# Script 과제 본문
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player
{
private int hp = 100;
private int power = 50;
public void Attack()
{
Debug.Log(this.power + " 대미지를 입혔다.");
}
public void Damage(int damage)
{
this.hp -= damage;
Debug.Log(damage + " 대미지를 입었다.");
}
}
public class Test : MonoBehaviour
{
void SayHello()
{
Debug.Log("Hello");
}
void CallName(string name)
{
Debug.Log("Hello " + name);
}
int Add(int a, int b)
{
int c = a + b;
return c;
}
// Start is called before the first frame update
void Start()
{
// Debug.Log("Hello World!");
// int age;
// age = 30;
// Debug.Log(age);
// float heigth1 = 160.5f;
// float heigth2;
// heigth2 = heigth1;
// Debug.Log(heigth2);
// string name;
// name = "Sera";
// Debug.Log(name);
// int answer;
// answer = 1 + 2;
// Debug.Log(answer);
// int answer;
// answer = 3 - 4;
// Debug.Log(answer);
//
// answer = 5 * 6;
// Debug.Log(answer);
//
// answer = 8 / 4;
// Debug.Log(answer);
// int n1 = 8;
// int n2 = 9;
// int answer;
// answer = n1 + n2;
// Debug.Log(answer);
// int answer = 10;
// answer += 5;
// Debug.Log(answer);
// int answer = 10;
// answer++;
// Debug.Log(answer);
// string str1 = "happy ";
// string str2 = "birthday";
// string message;
//
// message = str1 + str2;
// Debug.Log(message);
// string str1 = "happy ";
// string str2 = "birthday";
//
// str1 += str2;
// Debug.Log(str1);
// string str = "happy ";
// int num = 123;
//
// string messagee = str + num;
// Debug.Log(messagee);
// int herbNum = 1;
// if (herbNum == 1)
// {
// Debug.Log("체력을 50 회복");
// }
// int hp = 200;
// // int hp = 0
// if (hp >= 100)
// {
// Debug.Log("공격!");
// }
// else
// {
// Debug.Log("방어!");
// }
// int hp = 180;
// if (hp <= 50)
// {
// Debug.Log("도망!");
// }
// else if (hp >= 200)
// {
// Debug.Log("공격!");
// }
// else
// {
// Debug.Log("방어!");
// }
// int x = 1;
// if (x == 1)
// {
// int y = 2;
// Debug.Log(x);
// Debug.Log(y);
// }
// // Debug.Log(y);
// for (int i = 0; i < 5; i++)
// {
// Debug.Log(i);
// }
// for (int i = 0; i < 10; i += 2)
// {
// Debug.Log(i);
// }
// for (int i = 3; i <= 5; i++)
// {
// Debug.Log(i);
// }
// for (int i = 3; i >= 0; i--)
// {
// Debug.Log(i);
// }
// int sum = 0;
// for (int i = 1; i <= 10; i++)
// {
// sum += i;
// }
// Debug.Log(sum);
// int[] array = new int[5];
//
// array[0] = 2;
// array[1] = 10;
// array[2] = 5;
// array[3] = 15;
// array[4] = 3;
//
// for (int i = 0; i < 5; i++)
// {
// Debug.Log(array[i]);
// }
// int[] points = { 83, 99, 52, 93, 15 };
//
// for (int i = 0; i < points.Length; i++)
// {
// if (points[i] >= 90)
// {
// Debug.Log(points[i]);
// }
// }
// int[] points = { 83, 99, 52, 93, 15 };
//
// int sum = 0;
// for (int i = 0; i < points.Length; i++)
// {
// sum += points[i];
// }
//
// int average = sum / points.Length;
// Debug.Log(average);
// SayHello();
// CallName("Tom");
// int answer;
// answer = Add(2, 3);
// Debug.Log(answer);
// int answer;
// int num1 = 2;
// int num2 = 3;
// answer = Add(num1, num2);
// Debug.Log(answer);
// Player myPlayer = new Player();
// myPlayer.Attack();
// myPlayer.Damage(30);
// Vector2 playerPos = new Vector2(3.0f, 4.0f);
// playerPos.x += 8.0f;
// playerPos.y += 5.0f;
// Debug.Log(playerPos);
Vector2 startPos = new Vector2(2.0f, 1.0f);
Vector2 endPos = new Vector2(8.0f, 5.0f);
Vector2 dir = endPos - startPos;
Debug.Log(dir);
float len = dir.magnitude;
Debug.Log(len);
}
// Update is called once per frame
void Update()
{
// Debug.Log("Update");
}
}
'Unity > 선행학습' 카테고리의 다른 글
| [3일차] JSON 파일을 불러와 싱글톤으로 만든 DataManager 를 통해 Dictionary 관리하기. (0) | 2025.09.11 |
|---|---|
| [3일차] JSON 파일 불러와 역직렬화하여 Dcitionary 에 담기. (id 를 키로 사용할 것) (0) | 2025.09.11 |
| [3일차] Resources 폴더 내 JSON 파일 불러와 내용 출력하기. (0) | 2025.09.11 |
| [2일차] JSON 파일 미리보기 Unity Tool 만들기. (0) | 2025.09.10 |
| [2일차] CSV / JSON 파일을 Class 파일로 생성하는 Unity Tool 만들기. (0) | 2025.09.10 |