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 | 31 |
Tags
- UE5
- parameter
- Unreal Engine 5
- Material
- C#
- String
- 문제풀이
- Programming
- python
- Unity
- Algorithm
- loop
- c++
- Class
- dynamic
- 오류
- guide
- github
- Tutorial
- 재귀
- 파이썬
- 기초
- Basic
- DP
- 시작해요 언리얼 2022
- W3Schools
- 프로그래밍
- w3school
- dfs
- 백준
Archives
- Today
- Total
행복한 개구리
Unity 2D 1945 21.04.07 본문
04.07. 추가/수정안
ㄴ물방울이랑 발바닥이 만나면 둘 다 사라짐
ㄴ세로에서 가로모드로 바꿈
ㄴ물방울 나오는 범위 수정
ㄴ캣푸드 프리팹 완성시키고 적용은 아직 안함
ㄴ캣푸드 먹으면 20%씩 체력이 차며 30초마다 맵 왼쪽 절반에서 무작위 위치에 나타남
ㄴx축 모션 만드는중
ㄴ점수 텍스트UI추가
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CatFoodGenerator : MonoBehaviour
{
public GameObject catFoodPrefab;
float delta;
public float spawn;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
this.delta += Time.deltaTime;
if (this.delta >= 30f)
{
this.delta = 0;
GameObject go = Instantiate(catFoodPrefab) as GameObject;
int x = Random.Range(-9, 1);
go.transform.position = new Vector3(x, 5, 0);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CatFoodController : MonoBehaviour
{
public float dropSpeed;
GameObject player;
// Start is called before the first frame update
void Start()
{
this.player = GameObject.Find("cat1");
}
// Update is called once per frame
void Update()
{
Vector3 pos1 = this.player.transform.position;
Vector3 pos2 = this.gameObject.transform.position;
Vector3 dir = pos2 - pos1;
float d = dir.magnitude;
float r1 = 0.15f;
float r2 = 0.6f;
if(d < r1 + r2)
{
GameObject gd = GameObject.Find("GameDirector");
gd.GetComponent<GameDirector>().IncreaseHp();
Destroy(gameObject);
}
this.gameObject.transform.Translate(0, -dropSpeed, 0);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PawController : MonoBehaviour
{
public float speed = 0.03f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
this.gameObject.transform.Translate(0, speed, 0);
if(this.transform.position.y > 4.9f)
{
Destroy(gameObject);
}
}
public void OnTriggerEnter2D(Collider2D collision)
{
Destroy(gameObject);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaterController : MonoBehaviour
{
WaterGenerator wg;
GameObject player;
public float dropspeed;
float hp =1;
// Start is called before the first frame update
void Start()
{
this.player = GameObject.Find("cat1");
}
// Update is called once per frame
void Update()
{
this.transform.Translate(0, -dropspeed, 0);
Vector2 pos1 = this.transform.position;
Vector2 pos2 = this.player.transform.position;
Vector2 dir = pos1 - pos2;
float d = dir.magnitude;
float r1 = 0.1f;
float r2 = 0.6f;
if (d < r1 + r2)
{
GameObject director = GameObject.Find("GameDirector");
director.GetComponent<GameDirector>().DecreaseHp();
Destroy(gameObject);
}
if (this.transform.position.y < -4)
{
Destroy(gameObject);
}
}
public void OnTriggerEnter2D(Collider2D collision)
{
this.hp -= 0.5f;
if(this.hp <= 0)
{
Destroy(gameObject);
}
}
}
추가 예정 사항
ㄴx축 공격모션
ㄴ물방울 일정이상 생성시 강력한 물방울 생성
ㄴx축에서 랜덤한 시간에 웨이브 발생
ㄴ폭탄(궁극기)추가
ㄴ캐릭터가 풀 위쪽으로 못나가게 정의
ㄴ버튼구현(x축, y축 모드 바꾸기/이동/폭탄사용/지난 시간)
'Unity > Project : Unity 2D 1945' 카테고리의 다른 글
Unity 2D 1945 21.04.06 (0) | 2021.04.07 |
---|