// Start is called before the first frame update
 void Start()
 {
     if (!HolyWaterSystem.Get().CostHolyWater(HolyWaterCost))
     {
         Destroy(gameObject); return;
     }
     ResManager.Get().LoadAsync <GameObject>("Prefabs/UI/Unit/HP_Bar", (obj) => {
         obj.name = "HP_Bar";
         HP_Bar   = obj.transform.Find("Bar").gameObject;
         HP_Bar.SetActive(false);
         obj.transform.SetParent(this.transform);
         Vector3 vector3        = this.transform.position;
         vector3.y             += Height;
         obj.transform.position = vector3;
         obj.transform.rotation = Camera.main.transform.rotation;
         obj.GetComponent <HP_Bar>().SetUnit(this);
     });
     //检测初始化是否有错误
     if (CheckInitError())
     {
         Destroy(gameObject);
         return;
     }
     //OnBorn事件
     OnBorn();
     //子类初始化函数
     _Start();
     //AfterBorn事件
     AfterBorn();
 }
Example #2
0
 void AddHolyWaterPerRound(object info)
 {
     Debug.Log(base._position);
     if (GetPosition().Position.y == 0)
     {
         HolyWaterSystem.Get().AddHolyWater(1);
     }
 }
 void HolyWaterChanged(object info)
 {
     if (text == null)
     {
         text = GetComponentInChildren <UnityEngine.UI.Text>();
     }
     text.text = "圣水:" + HolyWaterSystem.Get().HolyWater.ToString();
 }
Example #4
0
 void OnGameInitialize()
 {
     GameObject grid = ResManager.Get().Load<GameObject>("Prefabs/GridSystem/GridSystem");
     grid.transform.SetParent(GameObject.Find("Ground").transform, false);
     GridSystem = grid.GetComponent<GridSystem>();
     GridSystem.enabled = true;
     GridSystem.gameObject.name = "GridSystem";
     HolyWaterSystem.Get().Init();
     RoundSystem.Get().Init(1);
     UIManager.Get();
     UIManager.Get().PushPanel(PanelTypes.HUDPanel);
     //GameNetwork.Getinstance().GetNetWorkManager();
 }