public void InitCharacterDic() { GameObject reimuPrefab = null; string path = "characters/reimu"; reimuPrefab = Resources.Load(path, typeof(GameObject)) as GameObject; if (reimuPrefab == null) { Debug.LogError("remimuPrefab is null"); return; } CharacterPropBase reimuProBase = new global::CharacterPropBase(); reimuProBase = reimuPrefab.GetComponent <CharacterPropBase>(); if (reimuProBase == null) { Debug.LogError("reimuProBase is null"); return; } CharacterPropDic.Add("reimu", reimuProBase); GameObject marisaPrefab = null; path = "characters/marisa"; marisaPrefab = Resources.Load(path, typeof(GameObject)) as GameObject; if (marisaPrefab == null) { Debug.LogError("marisaPrefab is null"); return; } CharacterPropBase marisaProBase = new global::CharacterPropBase(); marisaProBase = marisaPrefab.GetComponent <CharacterPropBase>(); if (marisaProBase == null) { Debug.LogError("marisaProBase is null"); return; } CharacterPropDic.Add("marisa", marisaProBase); }
public float UpdataHP_Boss(string name, float HP_now, float count, int sign) { CharacterPropBase boseeBaseData = new global::CharacterPropBase(); boseeBaseData = CharacterPropManager.Instance.GetCharcaterDataByName(name); float HPcount = HP_now + sign * count; Debug.LogError(HP_now); if (HPcount >= boseeBaseData.HP) { HPcount = boseeBaseData.HP; } if (HPcount <= 0) { HPcount = 0; } float index = (HPcount / boseeBaseData.HP); BossSlider.value = index; Debug.LogError(HPcount); return(HPcount); }