|
@@ -9,6 +9,8 @@ using System.ComponentModel;
|
|
|
using Unity.VisualScripting;
|
|
using Unity.VisualScripting;
|
|
|
using System;
|
|
using System;
|
|
|
using Base.Common;
|
|
using Base.Common;
|
|
|
|
|
+using cfg;
|
|
|
|
|
+using static UnityEngine.EventSystems.EventTrigger;
|
|
|
|
|
|
|
|
[Serializable]
|
|
[Serializable]
|
|
|
public struct AttackInfo
|
|
public struct AttackInfo
|
|
@@ -20,9 +22,11 @@ public struct AttackInfo
|
|
|
|
|
|
|
|
public class PlayerController : MoveCharacter
|
|
public class PlayerController : MoveCharacter
|
|
|
{
|
|
{
|
|
|
|
|
+ public static PlayerController instance;
|
|
|
|
|
|
|
|
public List<GameObject> demonicPrefabs;
|
|
public List<GameObject> demonicPrefabs;
|
|
|
public List<Vector3> demonicSummonPos;
|
|
public List<Vector3> demonicSummonPos;
|
|
|
|
|
+ public Dictionary<int, List<Demonic>> demonicDic;
|
|
|
|
|
|
|
|
public float jumpSpeed = 10;
|
|
public float jumpSpeed = 10;
|
|
|
public float airJumpSpeed = 10;
|
|
public float airJumpSpeed = 10;
|
|
@@ -142,18 +146,17 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
|
|
private void Awake()
|
|
private void Awake()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (!instance)
|
|
|
|
|
+ {
|
|
|
|
|
+ instance = this;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ DestroyImmediate(gameObject);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ demonicDic = new Dictionary<int, List<Demonic>>();
|
|
|
Init();
|
|
Init();
|
|
|
- Reload();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public override void Init()
|
|
|
|
|
- {
|
|
|
|
|
- base.Init();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public override void Reload()
|
|
|
|
|
- {
|
|
|
|
|
- base.Reload();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
private void Update()
|
|
@@ -379,6 +382,7 @@ public class PlayerController : MoveCharacter
|
|
|
summonTime -= Time.deltaTime;
|
|
summonTime -= Time.deltaTime;
|
|
|
rushTime -= Time.deltaTime;
|
|
rushTime -= Time.deltaTime;
|
|
|
cacheRushTime -= Time.deltaTime;
|
|
cacheRushTime -= Time.deltaTime;
|
|
|
|
|
+ dieKeepTime -= Time.deltaTime;
|
|
|
switch (state)
|
|
switch (state)
|
|
|
{
|
|
{
|
|
|
case CharacterState.Idle:
|
|
case CharacterState.Idle:
|
|
@@ -542,6 +546,13 @@ public class PlayerController : MoveCharacter
|
|
|
rb.velocity = Vector3.right * rushSpeed;
|
|
rb.velocity = Vector3.right * rushSpeed;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case CharacterState.Die:
|
|
|
|
|
+ if (dieKeepTime <= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ gameObject.SetActive(false);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -638,6 +649,7 @@ public class PlayerController : MoveCharacter
|
|
|
aniCollider.Play("Die", 0, 0);
|
|
aniCollider.Play("Die", 0, 0);
|
|
|
ani.Play("die", 0, 0);
|
|
ani.Play("die", 0, 0);
|
|
|
isDie = true;
|
|
isDie = true;
|
|
|
|
|
+ dieKeepTime = totalDieKeepTime;
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
@@ -693,6 +705,12 @@ public class PlayerController : MoveCharacter
|
|
|
GameObject prefab = demonicPrefabs[id];
|
|
GameObject prefab = demonicPrefabs[id];
|
|
|
GameObject demonicObj = PoolManager.Instantiate(prefab);
|
|
GameObject demonicObj = PoolManager.Instantiate(prefab);
|
|
|
Demonic demonic = demonicObj.GetComponent<Demonic>();
|
|
Demonic demonic = demonicObj.GetComponent<Demonic>();
|
|
|
|
|
+ demonic.id = id;
|
|
|
|
|
+ if (!demonicDic.ContainsKey(id))
|
|
|
|
|
+ {
|
|
|
|
|
+ demonicDic.Add(id, new List<Demonic>());
|
|
|
|
|
+ }
|
|
|
|
|
+ demonicDic[id].Add(demonic);
|
|
|
demonicObj.transform.parent = null;
|
|
demonicObj.transform.parent = null;
|
|
|
demonicObj.transform.localEulerAngles = Vector3.zero;
|
|
demonicObj.transform.localEulerAngles = Vector3.zero;
|
|
|
demonicObj.transform.localScale = new Vector3(1, 1, 1);
|
|
demonicObj.transform.localScale = new Vector3(1, 1, 1);
|
|
@@ -713,12 +731,22 @@ public class PlayerController : MoveCharacter
|
|
|
demonic.Turn();
|
|
demonic.Turn();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- demonic.BeSummon(100);
|
|
|
|
|
|
|
+ demonic.totalHp = 100;
|
|
|
|
|
+ demonic.Init();
|
|
|
|
|
+ demonic.SetSortingOrder(id * 1000 + demonicDic[id].Count);
|
|
|
demonic.Attack1();
|
|
demonic.Attack1();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public override void BeHit(int damage, Vector3 force)
|
|
|
|
|
|
|
+ public void OnDemonicRecycle(Demonic demonic)
|
|
|
{
|
|
{
|
|
|
- base.BeHit(damage, force);
|
|
|
|
|
|
|
+ if (!demonicDic.ContainsKey(demonic.id))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ demonicDic[demonic.id].Remove(demonic);
|
|
|
|
|
+ for (int i = 0; i < demonicDic[demonic.id].Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ demonicDic[demonic.id][i].SetSortingOrder(demonic.id * 1000 + i);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|