그 보스 페이즈? 노션 보고 잘 만들어주세요
TMP는 깃에서 없애야 하는데 저 할 줄 모르니까 알아서 잘 해보시고 어자피 프로젝트 크기 5메가바이트도 안 넘으니까 굳이굳이 할 필요 없으심 즐 전 자러감ㅋㅋ
This commit is contained in:
71
Assets/Scripts/Unicorn/Boss/Tuna.cs
Normal file
71
Assets/Scripts/Unicorn/Boss/Tuna.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unicorn.Hitbox;
|
||||
using UnityEngine;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace Unicorn.Boss
|
||||
{
|
||||
internal enum UnicornPhase
|
||||
{
|
||||
Start, P1, P2, P3, End
|
||||
}
|
||||
public class Tuna : LivingEntity
|
||||
{
|
||||
|
||||
private UnicornPhase _unicornPhase = UnicornPhase.Start;
|
||||
private Queue<GameObject> _p1Ps = new Queue<GameObject>();
|
||||
private const float P1PC = 12;
|
||||
|
||||
public Transform projContainer;
|
||||
public GameObject phase1Proj;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(Started());
|
||||
}
|
||||
|
||||
private IEnumerator Started()
|
||||
{
|
||||
while (_p1Ps.Count < 50)
|
||||
{
|
||||
for (var i = 0; i < 5 && _p1Ps.Count < 50; i++) //프레임당 5개씩 생성
|
||||
{
|
||||
var instantiate = Instantiate(phase1Proj, projContainer);
|
||||
_p1Ps.Enqueue(instantiate);
|
||||
instantiate.SetActive(false);
|
||||
}
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
StartCoroutine(Phase1());
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator Phase1()
|
||||
{
|
||||
_unicornPhase = UnicornPhase.P1;
|
||||
for (int i = 0; i < 360 / P1PC; i++)
|
||||
{
|
||||
var dequeue = _p1Ps.Dequeue();
|
||||
dequeue.SetActive(true);
|
||||
dequeue.transform.position = transform.position;
|
||||
var rotationEulerAngles = transform.rotation.eulerAngles;
|
||||
rotationEulerAngles.z += (360 / P1PC) * i;
|
||||
dequeue.transform.rotation = Quaternion.Euler(rotationEulerAngles);
|
||||
_p1Ps.Enqueue(dequeue);
|
||||
}
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(Phase1());
|
||||
}
|
||||
|
||||
protected override void OnKnockback(DamageInfo info)
|
||||
{
|
||||
//No KnockBack
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Unicorn/Boss/Tuna.cs.meta
Normal file
2
Assets/Scripts/Unicorn/Boss/Tuna.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f3078fdd3458bf459c4463291b07499
|
||||
@@ -1,14 +0,0 @@
|
||||
using Unicorn.Game.Hitbox;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game
|
||||
{
|
||||
public class Enemy : LivingEntity
|
||||
{
|
||||
protected override void OnDamaged(DamageInfo info)
|
||||
{
|
||||
var dir = transform.position - info.hitPoint;
|
||||
Rb.linearVelocity = dir.normalized * info.knockbackForce;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63fc82d3df1a3164584e678e0f04f817
|
||||
@@ -1,11 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
namespace Unicorn.Hitbox
|
||||
{
|
||||
public struct DamageInfo
|
||||
{
|
||||
public float damage;
|
||||
public float knockbackForce;
|
||||
public Vector3 hitPoint; // 넉백 방향 계산을 위해 필요
|
||||
public float Damage;
|
||||
public float KnockbackForce;
|
||||
public Vector3 HitPoint; // 넉백 방향 계산을 위해 필요
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64fa6e6de39c4aa418339d93d6f9c418
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4de4d4a74d5b4258863a8173560a93ab, type: 3}
|
||||
m_Name: ExampleAD
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornAttackDataSO
|
||||
damage: 3
|
||||
knockbackForce: 15
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67ddb0901f4c7754a9e47e5cf5cac286
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,9 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
namespace Unicorn.Hitbox
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NewAttackData", menuName = "Unicorn/AttackData")]
|
||||
public class UnicornAttackDataSO: ScriptableObject
|
||||
public class UnicornAttackDataSObj: ScriptableObject
|
||||
{
|
||||
public float damage;
|
||||
public float knockbackForce;
|
||||
@@ -1,19 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
namespace Unicorn.Hitbox
|
||||
{
|
||||
public class UnicornHitbox : MonoBehaviour
|
||||
{
|
||||
public UnicornAttackDataSO attackData;
|
||||
public UnicornAttackDataSObj attackData;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.TryGetComponent(out LivingEntity target)) return;
|
||||
var info = new DamageInfo
|
||||
{
|
||||
damage = attackData.damage,
|
||||
knockbackForce = attackData.knockbackForce,
|
||||
hitPoint = transform.position
|
||||
Damage = attackData.damage,
|
||||
KnockbackForce = attackData.knockbackForce,
|
||||
HitPoint = transform.position
|
||||
};
|
||||
|
||||
target.Damage(info);
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
using Unicorn.Game.Hitbox;
|
||||
using Unicorn.Hitbox;
|
||||
using UnityEngine;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace Unicorn.Game
|
||||
namespace Unicorn
|
||||
{
|
||||
public partial class LivingEntity : MonoBehaviour
|
||||
{
|
||||
private Rigidbody2D _rb;
|
||||
public float health = 20.0f;
|
||||
private Rigidbody2D Rb { get; set; }
|
||||
private bool _invulnerable = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
|
||||
Rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (_rb == null) return;
|
||||
if (Rb == null) return;
|
||||
var transformPosition = other.transform.position - transform.position;
|
||||
_rb.linearVelocity = Vector2.zero;
|
||||
_rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
|
||||
Rb.linearVelocity = Vector2.zero;
|
||||
Rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
|
||||
}
|
||||
|
||||
public void Damage(DamageInfo info)
|
||||
{
|
||||
health -= info.damage;
|
||||
if (_invulnerable) return;
|
||||
health -= info.Damage;
|
||||
OnDamaged(info);
|
||||
if (health <= 0.0f) OnDeath();
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnDeath()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
protected virtual void OnDeath() { }
|
||||
|
||||
public Rigidbody2D Rb => _rb;
|
||||
|
||||
protected virtual void OnDamaged(DamageInfo info)
|
||||
protected virtual void OnDamaged(DamageInfo info) { }
|
||||
|
||||
protected virtual void OnKnockback(DamageInfo info)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var dir = transform.position - info.HitPoint;
|
||||
Rb.AddForce(dir.normalized * info.KnockbackForce, ForceMode2D.Impulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Unicorn.Game.Hitbox;
|
||||
using Unicorn.Hitbox;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Player
|
||||
namespace Unicorn.Player
|
||||
{
|
||||
public class Player: LivingEntity
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Unicorn.System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Unicorn.Game.Player
|
||||
namespace Unicorn.Player
|
||||
{
|
||||
public class PlayerAttack: MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Unicorn.System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Unicorn.Game.Player
|
||||
namespace Unicorn.Player
|
||||
{
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user