일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- boss monster
- animation
- Replication
- gas
- DP
- 유스케이스
- Multiplay
- 언리얼 엔진
- ability task
- ret2libc
- dirty cow
- Delegate
- 메카님
- CTF
- 게임개발
- unity
- photon fusion2
- 운영체제
- 언리얼엔진
- Security
- 게임 개발
- MAC
- Race condition
- 유니티
- MLFQ
- DSP
- Rr
- gameplay ability system
- stride
- Unreal Engine
Archives
- Today
- Total
다양한 기록
[Fortress Craft] Commander_Archer - 외형, 화살 나가는 방향 UI 본문
외형은 판타지 영화에 나올법한 엘프 궁수를 생각하면서 만듦
궁수 캐릭터는 바라보는 방향으로 화살을 쏨
그런데 2D라 바라보는 방향을 x, y축 상에서 나타내면 어딜 보는지 알기가 힘듦
⇒ 바라보는 방향을 화살표로 나타냄
화살표는 예전에 다른 게임(Parring Sword) 만들 때 그렸던 거 재활용
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArrowVector : MonoBehaviour
{
public Vector2 TargetDirection { get; set; }
Vector3 pos;
private void Awake()
{
TargetDirection = Vector2.left;
}
private void FixedUpdate()
{
float angle = Mathf.Atan2(TargetDirection.y, TargetDirection.x) * Mathf.Rad2Deg;
Quaternion FireRotation = Quaternion.AngleAxis(angle - 90, Vector3.forward);
transform.rotation = FireRotation;
float range = 0.3f;
if( TargetDirection.y > 0.0f )
{
pos = new Vector3(TargetDirection.x * range, TargetDirection.y * range + 0.1f, 0.0f);
}
else
{
pos = new Vector3(TargetDirection.x * range, TargetDirection.y * range + 0.1f, 0.0f);
}
transform.position = transform.parent.position + pos;
}
}
'유니티 엔진 > Fortress Craft' 카테고리의 다른 글
[Fortress Craft] Commander 피격 판정 및 체력 바 (0) | 2025.02.05 |
---|---|
[Fortress Craft] Commander_Archer - 기본 공격, 스킬1, 스킬2 (0) | 2025.02.05 |
[Fortess Craft] 스프레드 시트와 연결 (0) | 2025.02.05 |
[Fortress Craft] 골드, 경험치 (0) | 2025.02.05 |
[Fortress Craft] Castle 생성 UI, 가격 설정 (0) | 2025.02.05 |