public List <MenuAction> getRiceTerrainActions(RiceTerrainTile riceTerrain) { //Debug.Log ("Actions for Terrain=" + riceTerrain.getChunkNumber ()); List <MenuAction> actionsAvailable = new List <MenuAction>(); if (!isActionInProgress(riceTerrain.getChunkNumber())) { List <int> actionsCurrentPhase = GameObject.FindGameObjectWithTag("Logic").GetComponent <PhaseManager>().getActionsInCurrentPhase(); for (uint i = 0; i < actionsCurrentPhase.Count; ++i) { int currentAction = actionsCurrentPhase[(int)i]; bool areDependenciesOk = riceTerrain.checkDependencies(_action[currentAction]); bool hasBeenInvestigated = InvestigationManager.GetInstance().areInvestigated(_action[currentAction].getInvestigationRequired()); bool hasWater = WorldTerrain.GetInstance().riceChunkHasWater(riceTerrain.getChunkNumber()) || !_action[currentAction].needCanal; bool hasActionDone = riceTerrain.isActionDone(currentAction); if (!hasActionDone && hasBeenInvestigated && areDependenciesOk && hasWater) { ChunkAction newAction = _action[currentAction]; PerformChunkAction callback = this.addActionInProgress; ChunkAction t = newAction.copyWithCallback(callback, riceTerrain.getChunkNumber()); actionsAvailable.Add((MenuAction)t); } //Debug.Log(" Action "+currentAction+" Dep="+areDependenciesOk+" Inv="+hasBeenInvestigated+" Water="+hasWater+" !Done="+!hasActionDone); } } actionsAvailable.Sort((x, y) => x.priority.CompareTo(y.priority)); return(actionsAvailable); }