/// <summary> /// Добавить новый блок растения по условию роста /// </summary> /// <param name="X"></param> /// <param name="Y"></param> /// <param name="OneBlockPlant"></param> private void AddNewBlockPlant(int X, int Y, BlockPlant OneBlockPlant) { if (OneBlockPlant.CanEnergyToGrowth) { TypeBlocks GetBlock = MainWorld.GetTypeBlockMap(X, Y); if (GetBlock != TypeBlocks.Blocked && (GetBlock == TypeBlocks.Void || GetBlock == TypeBlocks.Air)) { OneBlockPlant.SpendEnergyToGrowth(); StackBlocksPlant.Add(new BlockPlant(X, Y)); MainWorld.SetPointWorldMap(X, Y, TypeBlocks.Plant); } } }
/// <summary> /// Удалить блок растения с карты /// </summary> /// <param name="blockPlant"></param> public static void DieBlockInWorldMap(BlockPlant blockPlant) { MainWorld.SetPointWorldMap(blockPlant.X, blockPlant.Y, TypeBlocks.Void); }
/// <summary> /// Предикат определения смерти блока /// </summary> /// <param name="blockPlant"></param> /// <returns></returns> public static bool DeathByEnergyStarvation(BlockPlant blockPlant) { return(blockPlant.Energy <= 0); }