K-digital traning 65

[주말과제]SimpleRPG

어떻게든 해내려고 했는데,,, 합치는게 생각보다 많이 빡세네요,,,(사실 합치는 것만 문제는 아님) 테스트에서는 되던 녀석들이 합치려니까 null reference exception 자꾸 뜨고,,, 찾는 것도 일이고,,, 일단 그나마 합친 부분들 올려봅니당,,, (1)게임씬 using System.Collections; using System.Collections.Generic; using Test3; using UnityEngine; using UnityEngine.UI; public class GameSceneMain : MonoBehaviour { [SerializeField] private Image dim; private System.Action onFadeOutComplete; [Seriali..

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

플레이어의 기본 모션+달리는 모션을 연습해보았다,,, 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..