분류 전체보기 101

캐릭터 이동(달리기) 애니메이션

플레이어의 기본 모션+달리는 모션을 연습해보았다,,, 1.AddForce로 구현 using System.Collections; using System.Collections.Generic; using UnityEngine; public class HeroController : MonoBehaviour { private Animator anim; Rigidbody2D rBody2D; public float moveForce=1f; public float moveSpeed=1f; // Start is called before the first frame update void Start() { anim = GetComponent(); this.rBody2D = GetComponent(); } // Update ..

ClimbCloud

예제)고양이 구름 올라가기 게임 구현한 기능 - 충돌 감지 - 키 입력에 따른 고양이 이동 - 물리값 적용(ex. 중력) - 고양이의 움직임에 따른 카메라 무빙 . . . . (1)CatController.cs using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class CatController : MonoBehaviour { private Rigidbody2D rBody2D; private float jumpForce = 7f; private float moveForce = 30f; private Animator ..

[수업과제] 표창 던지기

1. Unity ※ Scene 생성 -> Shuriken Object 생성 -> C# script(ShurikenController) 생성 -> script를 object의 component로 붙이기 2. 스크립트 using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShurikenController : MonoBehaviour { //이동, 회전 속도(초기값 : 0) float moveSpeed; float rotAngle; float dampingCoefficient = 0.96f; Vector3 startPos; // Start is called before the first frame u..

주말과제...

※ 끝까지 하지 못하였습니다... 죄송합니다... (못한 부분 - 데이터 세이브(직렬화), 미션 출력, 미션 완료 시 드롭된 아이템 획득, 인벤토리 등) ※ 냥코대전쟁이라는 게임을 토대로 제작되었습니다... (1)DataManager.cs using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace HomeWork { public class DataManager { public static readonly DataManager Instance = new DataManage..

대리자 연습 - Hero HitDamage

(1)Hero.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class Hero { public int hp; public int maxHp; //생성자 public Hero() { this.hp = 10; this.maxHp = this.hp; } //남은체력 public void HitDamage(int damage, Action callback) { this.hp -= damage; callback(this.hp, this.maxHp); } //죽었니 살았니 public void ..

대리자 연습 - 데이터매니저 로드

(1) DataManager.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class DataManager { public static readonly DataManager Instance = new DataManager(); //대리자 멤버변수로 생성 public Action loadComplete; //생성자 private DataManager() { } public void LoadDatas() { Console.WriteLine("데이터 로드중..."); Console.Write..

대리자 연습 - Hero 이동

1.callback (1)App.cs using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class App { //생성자 public App() { Hero hero = new Hero(); Action action = () => { Console.WriteLine("영웅이 이동을 완료했습니다."); }; hero.Move(action); } } } or using System; using System.Collections.Gen..

1차원 배열 인벤토리 복습 (+ 인벤토리 용량확장

1. Items.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LearnDotnet { internal class Item { //멤버변수 string itemName; //생성자 public Item(string itemName) { this.itemName = itemName; } //아이템 이름 반환 메서드 public string GetItemName() { return this.itemName; } } } 2. Inventory.cs using System; using System.Collections.Generi..