public static void RemoveTiles(NodeBehaviour node) { if (node.GetListIndex() == -1) { return; } if (node.GetCurrentState() == NodeState.CurrentStateEnum.Field) { bool isPlant = false; if (node.gameObject.GetComponent <PlantPrefab>() != null) { SimpleMoneyManager.Instance.RemoveValue(node.gameObject.GetComponent <PlantPrefab>().MyPlant); EventManager.Instance.AddEnviromentValue ( node.GetComponent <NodeState>().FieldType, -node.GetComponent <PlantPrefab>().MyPlant.EnviromentValue ); EventManager.Instance.AddHappinessValue ( node.GetComponent <NodeState>().FieldType, -node.GetComponent <PlantPrefab>().MyPlant.Happiness ); if (node.GetComponent <PlantPrefab>().MyPlant.Upgrade) { CultivationManager.Instance.RemoveUpgradedCultivation(node.GetComponent <PlantPrefab>()); node.ResetNode(true, false); node.HighLight.ChangeColorToOld(); node.GetComponent <PlantPrefab>().ResetValues(); } isPlant = true; } node.ResetNode(isPlant, false); return; } int nodeCount = GridManager.Instance.GetCultivationLocationDictionary()[node.GetListIndex()].Count; int nodeIndex = node.GetListIndex(); for (int i = 0; i < nodeCount; i++) { var nodeBehaviour = GridManager.Instance.GetCultivationLocationDictionary()[nodeIndex][i]; nodeBehaviour.GetNodeFence().TryRemoveFence(); if (nodeBehaviour.gameObject.GetComponent <PlantPrefab>() != null) { SimpleMoneyManager.Instance.RemoveValue(nodeBehaviour.gameObject.GetComponent <PlantPrefab>().MyPlant); EventManager.Instance.AddEnviromentValue ( nodeBehaviour.GetComponent <NodeState>().FieldType, -nodeBehaviour.GetComponent <PlantPrefab>().MyPlant.EnviromentValue ); EventManager.Instance.AddHappinessValue ( nodeBehaviour.GetComponent <NodeState>().FieldType, -nodeBehaviour.GetComponent <PlantPrefab>().MyPlant.Happiness ); if (nodeBehaviour.GetComponent <PlantPrefab>().MyPlant.Upgrade) { CultivationManager.Instance.RemoveUpgradedCultivation(nodeBehaviour.GetComponent <PlantPrefab>()); } nodeBehaviour.GetComponent <PlantPrefab>().ResetValues(); } else if (nodeBehaviour.gameObject.GetComponent <BuildingPrefab>() != null) { SimpleMoneyManager.Instance.RemoveValue(nodeBehaviour.gameObject.GetComponent <BuildingPrefab>().MyBuilding); EventManager.Instance.AddEnviromentValue ( nodeBehaviour.GetComponent <NodeState>().FieldType, -nodeBehaviour.GetComponent <BuildingPrefab>().MyBuilding.EnviromentValue ); EventManager.Instance.AddHappinessValue ( nodeBehaviour.GetComponent <NodeState>().FieldType, -nodeBehaviour.GetComponent <BuildingPrefab>().MyBuilding.Happiness ); if (node.GetComponent <BuildingPrefab>().MyBuilding.Upgrade) { CultivationManager.Instance.RemoveUpgradedCultivation(node.GetComponent <BuildingPrefab>()); } } nodeBehaviour.ResetNode(false, true); } GridManager.Instance.GetCultivationLocationDictionary()[nodeIndex].Clear(); }