private void AddHpUI() { GameObject HP = null; HP = Instantiate(Resources.Load("Prefab/HP", typeof(GameObject)) as GameObject); HpUI = HP.GetComponent <HpUI>(); if (Type == uFantasy.Enum.BiologyType.Player) { HpUI.HPValue.sprite = Resources.Load <Sprite>("UI/ui-assets/HpGreen"); } if (Type != uFantasy.Enum.BiologyType.Player) { HpUI.HPValue.sprite = Resources.Load <Sprite>("UI/ui-assets/HpRed"); } HP.transform.SetParent(GameObject.Find("Canvas/HP").transform);//fixme:應該跟maingame要位置 HP.name = name + "HP"; HpUI.SetBio(this); BiologyAnimationEvent.HpUI = HpUI; }
// float playerHpPercent; void Awake() { _instance = this; }