summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-04-25 10:09:11 +0800
committerchai <chaifix@163.com>2022-04-25 10:09:11 +0800
commit8131033510c711248de1904649cfa1dbe4bbe69f (patch)
tree80e0db1f24c6d624ac412f240f54cc18e626c3d0 /SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs
parent71ae3d755a03a706d93291ca57c6de8e6f0d5926 (diff)
*rename item to prop
Diffstat (limited to 'SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs')
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs
new file mode 100644
index 0000000..59801f7
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs
@@ -0,0 +1,35 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public partial class PlayerManager : Singleton<PlayerManager>
+{
+ // 持有的物品
+ public List<PropBase> props { get { return m_Props; } }
+ private List<PropBase> m_Props = new List<PropBase>();
+
+ void InitProps()
+ {
+ m_Props.Add(new Prop_B2Phone());
+ m_Props.Add(new Prop_SpaceBeamer());
+ m_Props.Add(new Prop_NuclearBomb());
+ }
+
+ public void UseProp(PropBase prop)
+ {
+ if(!props.Contains(prop))
+ {
+ Debug.LogError("No such prop, name=" + prop.name);
+ return;
+ }
+ prop.OnUse(m_Crew.gameObject);
+ }
+
+ void UpdateProps()
+ {
+ for(int i = 0; i < props.Count; ++i)
+ {
+ props[i].Update();
+ }
+ }
+} \ No newline at end of file