public bool ChecktGrow() { if (DataManager.Instance.CurEnergy <= 0) { Debug.Log(" 能量不足"); return(false); } if (BotanyState == EnumBotanyState.Seed) { Debug.Log("新枝丫消耗"); var value = DataManager.Instance.EnergyConsumption(0, BotanyType); if (value <= 0) { return(false); } GrowDis += value; BotanyState = EnumBotanyState.GrowingUp; } timer -= Time.deltaTime; if (timer <= 0) { var value = DataManager.Instance.EnergyConsumption(1, BotanyType); if (value <= 0) { return(false); } GrowDis += value; timer = 1.0f; } return(true); }
public void DataInit(EnumBotanyType botanyType = EnumBotanyType.TypeDown) { BotanyState = EnumBotanyState.Seed; BotanyType = botanyType; switch (BotanyType) { case EnumBotanyType.TypeUp: speed = DataManager.Instance.branchGrowSpeed; break; case EnumBotanyType.TypeDown: speed = DataManager.Instance.rootGrowSpeed; break; default: break; } }