public void CloudCollected(BlockElementData data) { //Keep all resources up to date constantly ChangeResource(); //Increase relevant resource slot counter if (data.BlockName == slot1.BlockName) { slot1.SlotCounter.Value++; } else if (data.BlockName == slot2.BlockName) { slot2.SlotCounter.Value++; } else if (data.BlockName == slot3.BlockName) { slot3.SlotCounter.Value++; } else if (data.BlockName == slot4.BlockName) { slot4.SlotCounter.Value++; } else { Debug.Log("ERROR! Collected Cloud not in Resource Slots!!!"); } }
//Listen for new Level Event public void ChangeResource() { slot1 = currentLevel.Data.slot1; slot2 = currentLevel.Data.slot2; slot3 = currentLevel.Data.slot3; slot4 = currentLevel.Data.slot4; }
private void setSlotCounter(BlockElementData slotData, IntVariable slotCounter) { if (slotData != null) { slotData.SlotCounter = slotCounter; } }
private void PlayerTriggerBuilding(BlockElementData data) { if (isBuilding) { float heightBlockOffset = blockManager.Build(debuggingBlock, transform.position); transform.position += new Vector3(0, heightBlockOffset); } isBuilding = false; }
void FixedUpdate() { bool notTouchingUI = EventSystem.current.currentSelectedGameObject == null; if (Input.touchCount > 0 && notTouchingUI && selectedSlot.Value != null && selectedSlot.Value.Data != null) { BlockElementData selectedData = selectedSlot.Value.Data; indicator.GetComponent <SpriteRenderer>().sprite = selectedData.Indicator; indicator.SetActive(true); } }
public void ChangeResource(BlockElementData data) { if (data == null) { this.gameObject.SetActive(false); } else { this.gameObject.SetActive(true); Data = data; ResourceImage.sprite = Data.Icon; BlockNum.color = new Color(data.FontColor.r, data.FontColor.g, data.FontColor.b, BlockNum.color.a); BlockShadowNum.color = new Color(data.FontShadowColor.r, data.FontShadowColor.g, data.FontShadowColor.b, BlockShadowNum.color.a); } }
private IEnumerator createBlock(BlockElementData blockData, Vector3 playerPos, float t) { GameObject newBlock = Instantiate(blockData.BlockPrefab, playerPos - new Vector3(0, 0.1f, 0), Quaternion.identity, this.transform); float elapsedTime = 0; yield return(null); Vector3 originalScale = blockData.BlockPrefab.transform.localScale; Vector3 startingScale = new Vector3(0.1f, 0.1f, 0.1f); if (!blockData.name.Contains("Grow")) { newBlock.transform.localScale = startingScale; } while (newBlock.transform.localScale != originalScale) { newBlock.transform.localScale = Vector3.Lerp(startingScale, originalScale, (elapsedTime / t)); elapsedTime += Time.deltaTime; yield return(null); } }
private float buildBlock(BlockElementData blockData, Vector3 playerPos) { StartCoroutine(createBlock(blockData, playerPos, 0.19f)); return(blockData.playerBlockHeightOffset); }
public float Build(BlockElementData blockData, Vector3 playerPos) { return(buildBlock(blockData, playerPos)); }
private void Start() { tutorialMode = false; tutorialBlock = Resources.Load <BlockElementData>("ScriptsAndData/Data/Blocks/ShortBlock"); }
public void UpdateDisplayUI(BlockElementData blockData) { }