Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • J jyb-games
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • students
  • jyb-games
  • Wiki
  • 21.07.05

"server/git@compmath.korea.ac.kr:students/eue.git" did not exist on "737c5becee5dd48c9d36eba7000d26e76d68b2f0"
Last edited by seung ho yoo Jul 05, 2021
Page history

21.07.05

7월 5일

Defense_Game 만들기

타워 설치 및 발사체 생성 과 충돌

1. Tower 설치 할 Tile 깔기

  • Tile prefab형성을 한 후에 window - 2D - Tile palette를 이용해 tile을 깐다. image
    image

2. Tower prefab만들기

  • Tower prefab에 들어가는 sprite의 회전을 custom 해서 image의 중심의 회전이 아닌 pivot대로 회전하게함
    image
    image

3. 한 Tile에 한 Tower만 설치 될 수 있도록 tower 생성

  • Tile.cs : Tile에 tower가 설치 되어있는지 아닌지 보는 bool
    image

  • TowerSpawner.cs : 타일에 타워 설치 가능한지 보는 함수 image

  • TowerSpawner Object에 Script를 넣고 prefab 과 EnemySpanwer Script를 넣어줌
    image

  • ObjectDectector.cs : 마우스 클릭으로 tower설치
    image
    image

4. tower의 공격 대상 설정 및 발사체 생성

  • Projectile(발사체) Prefab 설치
    image

  • Tower Prefab에서 발사체가 spawn될 Spawn Point를 설정
    image
    image

  • TowerWeapon.cs : 타워의 공격
    타워의 기본 상태를 SearchTarget으로 바꾼다
    image

Target이 있으면 타겟을 바라보도록 회전 시킨다
image

적 찾기
image

공격
image

발사체 생성
image

Tower Prefab에 Tower Weapon script를 넣고 projectile prefab과 spawn point를 넣어준다
image

5. 발사체 충돌 및 사망 처리

  • Enemy prefab의 tag를 enemy로 설정
    image

  • Projectile.cs : 발사체의 이동과 충돌 관련 Script
    Target 설정 및 Update로 Target으로의 방향을 정함
    image

Projectile(발사체)와 충돌 할 수 있는 경우들 image

6. 발사체와 적의 충돌

  • Projectile prefab에 Projectile script 넣어준다
  • Projectile script와 enemy 충돌을 위해 enemy frefab에 circle collider 2D를 추가
    image
Clone repository
  • 21.06.28
  • 21.06.30
  • 21.07.02
  • 21.07.05
  • 21.07.07
  • 21.07.09
  • 21.07.12
  • 21.07.14
  • 21.07.16
  • 21.07.19
  • 21.07.26 (1)
  • 21.07.26
  • 21.07.28 DH
  • 21.07.28 SJ
  • 21.07.28
View All Pages