// function for checking if objects can be combined together public void CheckCombine(PickIntObj objA, PickIntObj objB) { if (objA != null) { objA.Click(); } if (objB != null) { objB.Click(); } InteractiveObject temp = null; for (int i = 0; i < relationList.Count; i++) { if (relationList [i].Key == objA) { temp = relationList [i].Value; break; } } for (int i = 0; i < relationList.Count; i++) { if (relationList [i].Value == temp && relationList [i].Key == objB) { temp.Click(); return; } } objA.Choose(); objB.Choose(); }
public bool AllocateSplitIntObj(GameObject obj, List <string> nextType, string thumbnail) { for (int chooseLocation = 0; chooseLocation < locations.Count; chooseLocation++) { if (locations [chooseLocation].Occupy()) { InteractiveObject intObj = new PickIntObj(locations [chooseLocation], obj, nextType, thumbnail); interactiveObjects.Add(intObj); relationList.Add( new KeyValuePair <InteractiveObject, InteractiveObject> ( intObj, lastIntObj)); keys.Add(intObj); return(true); } } return(false); }
// function for checking if the condition(s) of an obj is fulfilled public void GetLink(InteractiveObject intObj, PickIntObj selectedIntObj) { if (intObj == null) { selectedIntObj.Choose(); return; } if (selectedIntObj != null) { selectedIntObj.Click(); } bool related = false; for (int i = 0; i < relationList.Count; i++) { if (relationList [i].Value == intObj) { if (relationList [i].Key == selectedIntObj) { related = true; } if (!relationList[i].Key.IsSolved()) { if (selectedIntObj != null) { selectedIntObj.Choose(); } return; } } } if (!related && selectedIntObj != null) { selectedIntObj.Choose(); return; } intObj.Click(); }