summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts')
-rw-r--r--SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/EquipBase.cs28
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/Equip_Boomerang.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/LightSaber.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs63
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs.meta (renamed from SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta)0
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/BattleManager.cs1
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs1
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs1
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs12
-rw-r--r--SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs5
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs10
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs2
19 files changed, 175 insertions, 28 deletions
diff --git a/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs b/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
index 63cd979..78192e2 100644
--- a/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
+++ b/SurvivalTest/Assets/Scripts/Decorations/Decoration_Horn.cs
@@ -9,6 +9,6 @@ public class Decoration_Horn : DecorationBase
{
public override string name => "角";
- public override string iconPath => "art/ui/decoration/mestry_mask";
+ public override string iconPath => "art/ui/decoration/horn";
}
diff --git a/SurvivalTest/Assets/Scripts/Equips/EquipBase.cs b/SurvivalTest/Assets/Scripts/Equips/EquipBase.cs
index 334609d..ff8a198 100644
--- a/SurvivalTest/Assets/Scripts/Equips/EquipBase.cs
+++ b/SurvivalTest/Assets/Scripts/Equips/EquipBase.cs
@@ -16,6 +16,7 @@ public abstract class EquipBase
{
Interval, // 按时连发,需要设置Interval
Condition, // 按条件触发,需要重写CheckCondition
+ Always, // 常驻
}
public abstract AutoMode autoMode { get; }
@@ -26,6 +27,21 @@ public abstract class EquipBase
public virtual float interval { get; }
/// <summary>
+ /// 初始化
+ /// </summary>
+ public virtual void OnInitialize(GameObject owner)
+ {
+ }
+
+ /// <summary>
+ /// 销毁
+ /// </summary>
+ /// <param name="owner"></param>
+ public virtual void OnDestroy(GameObject owner)
+ {
+ }
+
+ /// <summary>
/// 使用装备
/// </summary>
public abstract void OnTrigger(GameObject owner);
@@ -33,9 +49,17 @@ public abstract class EquipBase
public virtual bool CheckCondition(GameObject owner)
{
return false;
- }
+ }
+
+ /// <summary>
+ /// 停止开火
+ /// </summary>
+ /// <param name="owner"></param>
+ public virtual void OnStop(GameObject owner)
+ {
+ }
- public virtual void Update()
+ public virtual void Update(GameObject owner)
{
}
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_Boomerang.cs b/SurvivalTest/Assets/Scripts/Equips/Equip_Boomerang.cs
index 7ee6a3b..8e3d917 100644
--- a/SurvivalTest/Assets/Scripts/Equips/Equip_Boomerang.cs
+++ b/SurvivalTest/Assets/Scripts/Equips/Equip_Boomerang.cs
@@ -27,7 +27,7 @@ public class Equip_Boomerang : EquipBase
{
}
- public override void Update()
+ public override void Update(GameObject owner)
{
}
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs b/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs
deleted file mode 100644
index a82ddc7..0000000
--- a/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Equip_LightSaber : EquipBase
-{
- public override string name => "光剑";
-
- public override string iconPath => "art/ui/equipicon/light_saber";
-
- public override AutoMode autoMode => AutoMode.Interval;
-
- public override float interval => 5f;
-
- public override void OnTrigger(GameObject owner)
- {
- }
-} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Equips/LightSaber.meta b/SurvivalTest/Assets/Scripts/Equips/LightSaber.meta
new file mode 100644
index 0000000..1920297
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Equips/LightSaber.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 253a4032920545c4488fd1eeedac07e3
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs b/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs
new file mode 100644
index 0000000..9066884
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs
@@ -0,0 +1,63 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Equip_LightSaber : EquipBase
+{
+ public override string name => "光剑";
+
+ public override string iconPath => "art/ui/equipicon/light_saber";
+
+ public override AutoMode autoMode => AutoMode.Condition;
+
+ private string lightSaberPrefabPath = "prefabs/weapon/light_saber";
+
+ private bool isWielding = false;
+
+ private LightSaber m_LightSaber;
+
+ private TopDownTransform m_TopDownTransform;
+
+ private float m_Dist = 0.2f;
+
+ public override void OnInitialize(GameObject owner)
+ {
+ m_LightSaber = UnityEngine.Object.Instantiate<LightSaber>(ResourceManager.Instance.Load<LightSaber>(lightSaberPrefabPath));
+ m_TopDownTransform = m_LightSaber.gameObject.GetComponent<TopDownTransform>();
+ SetLightSaberPositionAndRotation(owner.GetComponent<CrewScript>());
+ m_LightSaber.gameObject.SetActive(false);
+ }
+
+ public override bool CheckCondition(GameObject owner)
+ {
+ return true;
+ }
+
+ public override void OnTrigger(GameObject owner)
+ {
+ if (isWielding)
+ return;
+ isWielding = true;
+
+ m_LightSaber.gameObject.SetActive(true);
+ }
+
+ public override void OnStop(GameObject owner)
+ {
+ isWielding = false;
+ m_LightSaber.gameObject.SetActive(false);
+ }
+
+ public override void Update(GameObject owner)
+ {
+ CrewScript crew = owner.GetComponent<CrewScript>();
+ SetLightSaberPositionAndRotation(crew);
+ }
+
+ void SetLightSaberPositionAndRotation(CrewScript crew)
+ {
+ m_LightSaber.transform.position = crew.arrow.position + new Vector3(crew.aimDirection.x, crew.aimDirection.y, 0) * m_Dist;
+ m_LightSaber.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(crew.aimDirection.y, crew.aimDirection.x) * Mathf.Rad2Deg);
+ }
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta b/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs.meta
index dcc1028..dcc1028 100644
--- a/SurvivalTest/Assets/Scripts/Equips/Equip_LightSaber.cs.meta
+++ b/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs.meta
diff --git a/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs b/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs
new file mode 100644
index 0000000..4db08ee
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class LightSaber : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs.meta b/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs.meta
new file mode 100644
index 0000000..e8200d8
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Equips/LightSaber/LightSaber.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 72f3d28485a45ba4b8906603b170f9fa
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs b/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs
index ee52548..681e87b 100644
--- a/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/BattleManager.cs
@@ -8,6 +8,7 @@ public class BattleManager : Singleton<BattleManager>
public void Init()
{
UIManager.Instance.OpenPanel(PanelType.PanelTopSuffBar, null);
+ UIManager.Instance.OpenPanel(PanelType.PanelBossHpBar, null);
//UIManager.Instance.OpenPanel(PanelType.PanelItemBar, null);
//UIManager.Instance.OpenPanel(PanelType.PanelEquipBar, null);
}
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
index 95ad08e..bb97ce3 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager.cs
@@ -27,6 +27,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
public void SetCrew(CrewScript crew)
{
m_Crew = crew;
+ m_Equips.ForEach(e => e.OnInitialize(crew.gameObject));
}
} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
index 3f1669a..5076dea 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Decorations.cs
@@ -14,6 +14,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
{
m_Decorations.Add(new Decoration_MystreyMask());
m_Decorations.Add(new Decoration_PowerRing());
+ m_Decorations.Add(new Decoration_Horn());
}
void UpdateDecorations()
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
index 44197c7..d921545 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
@@ -38,7 +38,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
{
for(int i = 0; i < m_Equips.Count; ++i)
{
- m_Equips[i].Update();
+ m_Equips[i].Update(m_Crew.gameObject);
}
}
@@ -93,13 +93,14 @@ public partial class PlayerManager : Singleton<PlayerManager>
if (m_CoFire != null)
{
GameApp.Instance.StopCoroutine(m_CoFire);
+ m_Equips.ForEach(e => e.OnStop(m_Crew.gameObject));
m_CoFire = null;
}
}
}
/// <summary>
- /// 开火
+ /// 自由开火
/// </summary>
/// <returns></returns>
IEnumerator coFire()
@@ -124,6 +125,13 @@ public partial class PlayerManager : Singleton<PlayerManager>
{
}
}
+ else if(equip.autoMode == EquipBase.AutoMode.Condition)
+ {
+ if(equip.CheckCondition(m_Crew.gameObject))
+ {
+ equip.OnTrigger(m_Crew.gameObject);
+ }
+ }
}
yield return null;
}
diff --git a/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs b/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
index 86b781b..775b913 100644
--- a/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
+++ b/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
@@ -74,13 +74,10 @@ public class TestPeaceMaker : CrewScript
}
private ControlMode m_ControlMode;
- private void Awake()
+ void Start()
{
PlayerManager.Instance.SetCrew(this);
- }
- void Start()
- {
m_SpriteRenderer = GetComponent<SpriteRenderer>();
m_Coord = GetComponent<TopDownTransform>();
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar.meta
new file mode 100644
index 0000000..45721d1
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c5e2eef1c0b745b468cd7e02b389e9fd
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs
new file mode 100644
index 0000000..860143a
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs
@@ -0,0 +1,10 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PanelBossHpBar : PanelBase
+{
+ public override void Set(object param)
+ {
+ }
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs.meta b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs.meta
new file mode 100644
index 0000000..c10ee49
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelBossHpBar/PanelBossHpBar.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f0cc24522a8627e45968194d9e4f1db6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs
index ecb6ea1..9025984 100644
--- a/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs
+++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelTopStuffBar/UIItemBar.cs
@@ -17,6 +17,8 @@ public class UIItemBar : MonoBehaviour
public void Set()
{
+ m_ItemTempalte.gameObject.SetActive(false);
+
for (int i = 0; i < PlayerManager.Instance.items.Count; ++i)
{
ItemWidget widget = MakeItemWidget(PlayerManager.Instance.items[i]);
diff --git a/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
index d53a4e6..02b3a06 100644
--- a/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
+++ b/SurvivalTest/Assets/Scripts/UI/UIManager_Panels.cs
@@ -11,6 +11,7 @@ public enum PanelType
PanelItemBar,
PanelEquipBar,
PanelTopSuffBar,
+ PanelBossHpBar,
}
public partial class UIManager : Singleton<UIManager>
@@ -31,6 +32,7 @@ public partial class UIManager : Singleton<UIManager>
AddPanel(PanelType.PanelItemBar, "PanelItemBar");
AddPanel(PanelType.PanelEquipBar, "PanelEquipBar");
AddPanel(PanelType.PanelTopSuffBar, "PanelTopSuffBar");
+ AddPanel(PanelType.PanelBossHpBar, "PanelBossHpBar");
}
void AddPanel(PanelType type, string path)