일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- CTF
- nanite
- 언리얼 엔진
- dirty cow
- gravity direction
- 게임개발
- rpc
- Aegis
- gameplay tag
- UI
- 언리얼엔진
- os
- listen server
- gameplay ability system
- gameplay effect
- MAC
- map design
- 유니티
- gas
- stride
- local prediction
- Replication
- attribute
- 게임 개발
- animation
- unity
- Unreal Engine
- photon fusion2
- ability task
- Multiplay
Archives
- Today
- Total
Replicated
[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 |