private bool isHillOrLooping(RollerCoasterItem.RCItemType itemType) { if (itemType == itemTypeHill || itemType == itemTypeLooping) { return(true); } return(false); }
private bool isAnyBankedCurve(RollerCoasterItem.RCItemType itemType) { if (itemType == itemTypeBankedCurve10 || itemType == itemTypeBankedCurve15 || itemType == itemTypeBankedCurve20) { return(true); } return(false); }
void Start() { startText = "Start by adding a Hill. Select a size with the plus and minus buttons. Press the round button to add it."; currentItemIndex = 0; previewItemsList = new List <GameObject>(); cartHasBeenAdded = false; modelPlayButton.SetActive(true); modelStopButton.SetActive(false); // get all preview items into list Transform previewParent = transform.Find("Previews"); foreach (Transform child in previewParent) { previewItemsList.Add(child.gameObject); } // only display first item foreach (GameObject currentItem in previewItemsList) { currentItem.SetActive(false); } previewItemsList[0].SetActive(true); // set text name also RollerCoasterBuilderPreviewItem currentPreviewItem = previewItemsList[0].GetComponent <RollerCoasterBuilderPreviewItem>(); SetItemNameTMP(currentPreviewItem.CurrentItemName); operationInProgress = false; trackIsComplete = false; // assign the types to variables to keep them shorter itemTypeStartHill = RollerCoasterItem.RCItemType.StartHill; itemTypeHill = RollerCoasterItem.RCItemType.Hill; itemTypeBankedCurve10 = RollerCoasterItem.RCItemType.BankedCurve10; itemTypeBankedCurve15 = RollerCoasterItem.RCItemType.BankedCurve15; itemTypeBankedCurve20 = RollerCoasterItem.RCItemType.BankedCurve20; itemTypeLooping = RollerCoasterItem.RCItemType.Looping; itemTypeCart = RollerCoasterItem.RCItemType.Cart; rcItemList = new List <RollerCoasterItem.RCItemType>(); addableList = new List <RollerCoasterItem.RCItemType>(); updateAddableList(); bankedCurveSizes = new List <RollerCoasterItem.RCItemType>(); bankedCurveSizes.Add(itemTypeBankedCurve10); bankedCurveSizes.Add(itemTypeBankedCurve15); bankedCurveSizes.Add(itemTypeBankedCurve20); // set start instructions additionalText.text = startText; // get gamecontroller gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>(); }
private void updateItemAdditionalText(RollerCoasterItem.RCItemType itemType) { if (!isItemAddable(itemType)) { additionalText.text = "You can't add this part right now."; } else { if (rcItemList.Count == 0 && itemType == itemTypeHill) { additionalText.text = startText;; } else { additionalText.text = ""; } } }
// checks if current item can be addeed to rollercoaster private bool isItemAddable(RollerCoasterItem.RCItemType itemType) { return(addableList.Contains(itemType)); }