void OnTriggerStay2D(Collider2D other) { if (other.gameObject.name == "Runes" && currentTool == 1) { RuneScript.Fix(); } }
// Start is called before the first frame update void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); originalSprite = spriteRenderer.sprite; _instance = this; breakState = 1; Fix(); }
// this function creates the rune and adds it to the players inventory (if specified) // this rune will then be stored in a script which can be saved later on and accessed later on public void CreateRune() { RuneNumberAt = TheManager.ReturnRuneCount(); RuneScriptGenerated = new RuneScript(); GenerateRune(); RuneScriptGenerated.SetRuneName("Rune " + RuneNumberAt); RuneScriptGenerated.SetRuneOwner("Player"); TheManager.AddRuneToData(RuneScriptGenerated); RuneNumberAt++; }
public void ClearUI() { RuneBiengUsed = null; NoRuneUsed.gameObject.SetActive(true); RuneName.text = "Rune Name:"; RuneLevelText.text = "Rune Level: "; RuneStar.text = "Rune Star: "; RuneGrade.text = "Rune Rarity: "; RuneSlot.text = "Rune Slot:"; MainRuneStat.text = "0"; RuneOneStat.text = "0"; RuneTwoStat.text = "0"; RuneThreeStat.text = "0"; RuneFourStat.text = "0"; }
// Functions // this function will allow to add a rune to the list of rune scripts. only after checking to make sure it is not a duplicate rune // Params: // - TheRune : this is the rune that is going to be checked and then added to the players rune list public void AddSelectedRune(RuneScript TheRune) { bool RuneSeen = false; foreach (RuneScript R in PlayerRunes) { if (R.ReturnRuneName() == TheRune.ReturnRuneName()) { RuneSeen = true; } } if (!RuneSeen) { PlayerRunes.Add(TheRune); } }
void OnTriggerStay2D(Collider2D other) { if (!RuneScript.isBroken()) { return; } if (other.name == "Soul") { if (!isCarrying) { isCarrying = true; Destroy(other.gameObject); if (carrySoul != null) { spriteRenderer.sprite = carrySoul; } } } myRigid.angularVelocity = 0f; }
public void ClearUI() { MonsterBiengUsed = null; RuneBiengUsed = null; MonsterLevel.text = "Level: "; MonstersName.text = "Name: "; MonsterHealth.text = "Health: "; MonsterDamage.text = "Attack: "; MonsterDefence.text = "Defence: "; MonsterSpeed.text = "Speed: "; MonsterAccuracy.text = "Accuracy: "; MonsterResistance.text = "Resistance: "; MonsterCritRate.text = "Crit Rate: "; MonsterCritDamage.text = "Crit Damage: "; MonsterType.text = "Type: "; MonsterAwakening.text = "Awakened: "; MonsterStars.text = "Stars: "; }
void FixedUpdate() { if (Global.Instance.isGameOver()) { return; } Vector2 currentPos = new Vector2(transform.position.x, transform.position.y); if (!RuneScript.isBroken()) { if (currentPos != origin) { transform.position = origin; } isCarrying = false; spriteRenderer.sprite = originalSprite; transform.localScale = new Vector2(someScale, transform.localScale.y); direction = 1; return; } if (!isCarrying) { GameObject obj = FindClosestTarget("Soul"); if (obj != null) { Vector2 soulPos = new Vector2(obj.transform.position.x, obj.transform.position.y); transform.position = Vector2.MoveTowards(currentPos, soulPos, speed); } } else { if (currentPos == origin) { isCarrying = false; spriteRenderer.sprite = originalSprite; speed *= 1.2f; Global.Instance.UpdateLives(); } else { transform.position = Vector2.MoveTowards(currentPos, origin, speed); } } if (transform.position.x < _posX) { if (direction == 1) { transform.localScale = new Vector2(-someScale, transform.localScale.y); direction = -1; } } else if (transform.position.x > _posX) { if (direction == -1) { transform.localScale = new Vector2(someScale, transform.localScale.y); direction = 1; } } _posX = transform.position.x; }
// Start is called before the first frame update void Start() { TheManager = FindObjectOfType <GameManagment>(); NoRuneUsed.gameObject.SetActive(true); RuneBiengUsed = null; }
//this sets the rune that is bieng used from the selection and then refreshes the UI. public void SetRuneInUse() { RuneBiengUsed = TheManager.ReturnSelectedRune(EventSystem.current.currentSelectedGameObject.name); ChangeUI(); }
// this sets the rune that is currently bieng used public void SetRuneBiengUsed(RuneScript TheRune) { RuneBiengUsed = TheRune; }
// a function specifically made to add Runes to the players information public void AddRuneToData(RuneScript RuneAdded) { GameData.PlayerInformation.AddSelectedRune(RuneAdded); Save(); }
// a function used to select a certain rune that has been equiped on the monster public void RuneMainButton(int RuneNumber) { switch (RuneNumber) { case (1): { if (MonsterBiengUsed.ReturnRune(1) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(1); RunePanel.SetActive(true); RefreshRuneUI(); } break; } case (2): { if (MonsterBiengUsed.ReturnRune(2) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(2); RunePanel.SetActive(true); RefreshRuneUI(); } break; } case (3): { if (MonsterBiengUsed.ReturnRune(3) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(3); RunePanel.SetActive(true); RefreshRuneUI(); } break; } case (4): { if (MonsterBiengUsed.ReturnRune(4) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(4); RunePanel.SetActive(true); RefreshRuneUI(); } break; } case (5): { if (MonsterBiengUsed.ReturnRune(5) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(5); RunePanel.SetActive(true); RefreshRuneUI(); } break; } case (6): { if (MonsterBiengUsed.ReturnRune(6) != null) { RuneBiengUsed = MonsterBiengUsed.ReturnRune(6); RunePanel.SetActive(true); RefreshRuneUI(); } break; } } }
// a function attached to the button // this function will make a pop up appear // allows the player to upgrade the rune, equip the rune or destroy the rune public void RuneButtonFunc() { RuneBiengUsed = TheManager.ReturnSelectedRune(EventSystem.current.currentSelectedGameObject.name); RunePanel.SetActive(true); RefreshRuneUI(); }