// Use this for initialization void Start() { // generate all of the prefabs for the waypoints float xOff = -3.2F; float yOff = 0.0F; foreach (OverlandWaypointModel waypoint in tileModel.waypoints) { GameObject newObject = (GameObject)Instantiate(Resources.Load("Prefabs/WaypointView")); WaypointView objWv = newObject.GetComponent <WaypointView>(); objWv.model = waypoint; objWv.drawBasedOnModel(); newObject.transform.parent = this.transform; newObject.transform.localPosition = new Vector2(xOff, yOff); xOff += 0.4F; yOff -= 0.08F; } // set the first waypoint to reached OverlandWaypointModel first = (OverlandWaypointModel)tileModel.waypoints [0]; first.reached = true; first.passed = false; }
private void revealWaypointsAfterCamp(int campIndex, OverlandTileModel tileModel) { bool foundNext = false; int nextWaypoint = tileModel.waypoints.Count - 1; for (int dex = campIndex + 1; dex < tileModel.waypoints.Count; dex++) { // and stop at the next waypoint if (!foundNext) { OverlandWaypointModel wap = (OverlandWaypointModel)tileModel.waypoints[dex]; if (wap.waypointType == ewaypointType.waypointCamp) { nextWaypoint = dex; foundNext = true; } } } Debug.Log(string.Format("checking dex{0} next{1}", campIndex, nextWaypoint)); for (int dex = campIndex; dex <= nextWaypoint; dex++) { OverlandWaypointModel wap = (OverlandWaypointModel)tileModel.waypoints[dex]; wap.beyondNextCamp = false; } }
public OverlandTileModel() { for (int index = 0; index < 24; index++) { OverlandWaypointModel waypoint = new OverlandWaypointModel(); waypoint.waypointType = ewaypointType.waypointIcon; waypoint.iconRequirement = ewaypointType.waypointBoots; // just to be clear what I'm doing if (index == 8 || index == 16) { waypoint.waypointType = ewaypointType.waypointCamp; } if (index == 5 || index == 19) { waypoint.iconRequirement = ewaypointType.waypointMaps; } if (index == 3) { waypoint.iconRequirement = ewaypointType.waypointBlades; } if (index == 12) { waypoint.waypointType = ewaypointType.waypointEncounter; } if (index == 21) { waypoint.iconRequirement = ewaypointType.waypointCups; } if (index == 23) { waypoint.waypointType = ewaypointType.waypointFinal; } if (index > 8) { waypoint.beyondNextCamp = true; } waypoints.Add(waypoint); } OverlandWaypointModel firstModel = (OverlandWaypointModel)waypoints[0]; firstModel.waypointType = ewaypointType.waypointStart; }
// public void processSeries(CrewModel theCrew, ArrayList dice, OverlandTileModel tileModel) { foreach (DieView die in dice) { // get an array of effects on the current side ArrayList results = die.model.iconsOnCurrentSide(); foreach (edieIcon icon in results) { processAction(theCrew, icon, tileModel, dice); } } int finalIndex = 0; int startIndex = tileModel.currentNode; bool movementHalted = false; // process progress total if (theCrew.progress > 0) { for (int index = 0; index <= theCrew.progress; index++) { if (!movementHalted) { OverlandWaypointModel wap = (OverlandWaypointModel)tileModel.waypoints[index + tileModel.currentNode]; //OverlandWaypointModel startNode = (OverlandWaypointModel)tileModel.waypoints[startIndex]; // verify we have the prerequisite for the next // if we LAND on a camp, we're done. if (wap.waypointType == ewaypointType.waypointCamp && index + tileModel.currentNode != startIndex) { movementHalted = true; // display further waypoints revealWaypointsAfterCamp(index + tileModel.currentNode, tileModel); } // if we LAND on an encounter, we're done. if (wap.waypointType == ewaypointType.waypointEncounter && index + tileModel.currentNode != startIndex) { movementHalted = true; } // if we LAND on an icon that we don't have in hand, we're done if (wap.waypointType == ewaypointType.waypointOptionalEncounter && index + tileModel.currentNode != startIndex) { //movementHalted = true; } // icon waypoint if (wap.waypointType == ewaypointType.waypointIcon && index + tileModel.currentNode != startIndex && wap.iconRequirement != ewaypointType.waypointBoots) { // check to see if we have one if (!hasRequiredIcon(dice, wap.iconRequirement)) { movementHalted = true; } } // if we LAND on the final, we're done finalIndex = index + tileModel.currentNode; // check the previous waypoint if (index + tileModel.currentNode - 1 >= 0) { OverlandWaypointModel bak = (OverlandWaypointModel)tileModel.waypoints[index + tileModel.currentNode - 1]; bak.passed = true; } wap.reached = true; } } } tileModel.currentNode = finalIndex; // reset crew progress theCrew.progress = 0; }