summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Props.cs
blob: 59801f73e71997192d858d8a4c5fe92cacfb7695 (plain)
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
29
30
31
32
33
34
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();
		}
	}
}