일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- animation
- 유니티
- unity
- CTF
- boss monster
- DSP
- MAC
- Rr
- Delegate
- Multiplay
- dirty cow
- 유스케이스
- 메카님
- 운영체제
- 게임개발
- DP
- 언리얼 엔진
- stride
- Race condition
- 게임 개발
- gas
- gameplay ability system
- photon fusion2
- 언리얼엔진
- Replication
- MLFQ
- Security
- Unreal Engine
- ret2libc
- ability task
Archives
- Today
- Total
다양한 기록
[Fortress Craft] Commander_Magician - 기본 공격, 스킬1, 스킬2 본문
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Fusion;
using NetworkRigidbody2D = Fusion.Addons.Physics.NetworkRigidbody2D;
namespace Agit.FortressCraft
{
public class MagicianSpell : NetworkBehaviour
{
public Transform Target { get; set; }
private NetworkRigidbody2D _rb;
public float SpellSpeed { get; set; }
public NetworkPrefabId ID { get; set; }
public bool Fired { get; set; }
public string OwnType { get; set; }
private TickTimer destroyTimer;
private MagicianSpellAttackCollider attackCollider;
public override void Spawned()
{
_rb = GetComponent<NetworkRigidbody2D>();
attackCollider = GetComponent<MagicianSpellAttackCollider>();
Target = null;
Invoke("DestroySelf", 1.3f);
}
public override void FixedUpdateNetwork()
{
Target = null;
Collider2D[] cols = Physics2D.OverlapCircleAll(
new Vector2(transform.position.x, transform.position.y), 3.0f);
foreach (Collider2D col in cols)
{
if (col.tag.StartsWith("Unit"))
{
if (!col.CompareTag("Unit_" + OwnType))
{
if( col.transform.parent != null )
{
Target = col.transform.parent;
}
else
{
Target = col.transform;
}
break;
}
}
}
if (Target != null)
{
_rb.Rigidbody.velocity = ( Target.position - transform.position ).normalized * SpellSpeed;
}
else
{
Debug.Log("Magic Can't Move");
_rb.Rigidbody.velocity = Vector2.zero;
}
}
public void DestroySelf()
{
Destroy(this.gameObject);
}
}
}
적을 추적하는 에너지 구체
파티클 시스템을 이용해서 만들었음
적이 없으면 가만히 있음
스킬1
화염 방사, 드래곤의 브레스 같은 느낌
파티클 시스템을 이용해서 만들었음
공격 판정은 Animation에서 컬라이더 켜는 걸로 설정
* 플레이어를 공격하지 못하는 버그
트리거 처리는 RigidBody가 물체 둘 중 하나는 있어야 가능함
근데 플레이어에 RigidBody (NetworkRigidBody2D)가 아니라 NetworkCharacterController를 씀
=> 트리거에 같이 붙여줬음
* 스킬2 회전 로테이션 안되는 버그
RPC 써서 해결
스킬2
주기적으로 적을 공격하는 설치기
5초 지속 10초 쿨타임, 공격 주기 0.5초
파티클 시스템을 이용해 직접 만들었고, 파티클에 들어가는 이미지는 직접 그렸음
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Fusion;
using NetworkRigidbody2D = Fusion.Addons.Physics.NetworkRigidbody2D;
namespace Agit.FortressCraft
{
public class MagicianTwinkle : NetworkBehaviour
{
public NetworkPrefabId ID { get; set; }
private TickTimer onOfftimer;
private TickTimer destroyTimer;
private BoxCollider2D trigger;
public override void Spawned()
{
trigger = GetComponentInChildren<BoxCollider2D>();
onOfftimer = TickTimer.CreateFromSeconds(Runner, 0.01f);
destroyTimer = TickTimer.CreateFromSeconds(Runner, 5.0f);
}
public override void FixedUpdateNetwork()
{
if( destroyTimer.Expired( Runner ) )
{
Destroy(this.gameObject);
}
if( onOfftimer.Expired(Runner) )
{
trigger.enabled = !trigger.enabled;
onOfftimer = TickTimer.CreateFromSeconds(Runner, 0.5f);
}
}
}
}
0.5초 주기로 트리거를 껐다 켰다 반복함
'유니티 엔진 > Fortress Craft' 카테고리의 다른 글
[Fortress Craft] Boss Monster - Frost Lizard AI (0) | 2025.02.06 |
---|---|
[Fortress Craft] BossMonster - Frost Lizard 일러스트, 애니메이션 (0) | 2025.02.06 |
[Fortress Craft] Commander_Magician - 기본 외형 및 컨셉 기획 (0) | 2025.02.05 |
[Fortress Craft] Commander 피격 판정 및 체력 바 (0) | 2025.02.05 |
[Fortress Craft] Commander_Archer - 기본 공격, 스킬1, 스킬2 (0) | 2025.02.05 |