private void SetGemColor() { int randomIndex = Random.Range(0, spriteList.Count); gameObject.GetComponent <SpriteRenderer>().sprite = spriteList[randomIndex]; gemSprite = gameObject.GetComponent <SpriteRenderer>().sprite; switch (gemSprite.name) { case "purple_gem_animation_0": color = Enumerations.color.purple; break; case "green_gem_animation_0": color = Enumerations.color.green; break; case "red_gem_animation_0": color = Enumerations.color.red; break; case "teal_gem_animation_0": color = Enumerations.color.teal; break; } }
public void SetDoorColor(Enumerations.color color) { this.color = color; SetChildColor(); SetDoorSprite(); SetDoorAnimator(); }
public Enumerations.color ConvertGemColor(Enumerations.color inputColor) { Enumerations.color outputColor = Enumerations.color.red; switch (inputColor) { case Enumerations.color.red: outputColor = Enumerations.color.green; break; case Enumerations.color.green: outputColor = Enumerations.color.purple; break; case Enumerations.color.purple: outputColor = Enumerations.color.teal; break; case Enumerations.color.teal: outputColor = Enumerations.color.red; break; } return(outputColor); }
private void RandomizeDoorColors() { Door[] doorArray = FindObjectsOfType <Door>(); foreach (var item in doorArray) { if (item.tag == "Door") { int randomIndex = Random.Range(0, 4); Enumerations.color color = Enumerations.color.red; switch (randomIndex) { case 0: color = Enumerations.color.purple; break; case 1: color = Enumerations.color.green; break; case 2: color = Enumerations.color.red; break; case 3: color = Enumerations.color.teal; break; } item.SetDoorColor(color); } } }
public void UpdateGemButtons() { foreach (var item in gemButtons) { Enumerations.color color = item.GetButtonColor(); item.UpdateNumberOfGems(gemInventory[color]); } }
public void OpenDoor(Enumerations.color color) { if (nearDoor && doorColor == color) { inventory.UseGems(color, 1); Destroy(doorObject); nearDoor = false; } }
public void OpenDoor(Enumerations.color color) { if (nearDoor && doorColor == color) { inventory.UseGems(color, 1); doorObject.GetComponent <Destroyer>().Disappear(); nearDoor = false; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Door") { nearDoor = true; doorNearPlayer = collision.gameObject.GetComponent <Door>(); doorColor = doorNearPlayer.GetDoorColor(); doorObject = collision.gameObject; } }
private void UpdateGemButton(Enumerations.color color) { foreach (var item in gemButtons) { if (item.GetButtonColor() == color) { item.UpdateNumberOfGems(gemInventory[color]); } } }
private string GetSpriteName(Enumerations.color color) { string spriteName = ""; if (doorType == Enumerations.doorType.front) { switch (color) { case Enumerations.color.purple: spriteName = "portal_purple_animation_0"; break; case Enumerations.color.green: spriteName = "portal_green_animation_0"; break; case Enumerations.color.red: spriteName = "portal_red_animation_0"; break; case Enumerations.color.teal: spriteName = "portal_teal_animation_0"; break; } } else if (doorType == Enumerations.doorType.side) { switch (color) { case Enumerations.color.purple: spriteName = "portals_top_24"; break; case Enumerations.color.green: spriteName = "portals_top_20"; break; case Enumerations.color.red: spriteName = "portals_top_28"; break; case Enumerations.color.teal: spriteName = "portals_top_16"; break; } } return(spriteName); }
private void SetDoorColor() { switch (doorSprite.name) { case "purpleDoor": color = Enumerations.color.purple; break; case "greenDoor": color = Enumerations.color.green; break; case "redDoor": color = Enumerations.color.red; break; case "yellowDoor": color = Enumerations.color.yellow; break; } }
private void SetGemColor() { switch (gemSprite.name) { case "purpleGem": color = Enumerations.color.purple; break; case "greenGem": color = Enumerations.color.green; break; case "redGem": color = Enumerations.color.red; break; case "yellowGem": color = Enumerations.color.yellow; break; } }
public void OnPointerDown(PointerEventData eventData) { isConverterActive = gemConverter.converterActive; if (isConverterActive) { int manaCost = inventory.GetManaCost(color); mana.AdjustMana(-manaCost); Enumerations.color convertedColor = gemConverter.ConvertGemColor(color); inventory.UseGems(color, 1); inventory.AddGems(convertedColor, 1); } else if (!isConverterActive) { //check if number of gems is greater than 0 if (currentGemNumber > 0) { wizard.OpenDoor(color); } } }
public int GetManaCost(Enumerations.color color) { return(manaCostDictionary[color]); }
public void UseGems(Enumerations.color color, int number) { gemInventory[color] -= number; UpdateGemButton(color); }