/// <summary> /// Should just update the pippad /// </summary> /// <param name="PipSection"></param> /// <param name="PipPadTextHolder"></param> /// <param name="PipPadImageHolder"></param> public void UpdatePipPadDisplay(PipModel PipSection, Dictionary <string, Text> PipPadTextHolder, Dictionary <string, Image> PipPadImageHolder) { //child.gameObject.GetComponent<Image>().color = new Color(255f, 255f, 0f); //PipSection.Name.ToString(); PipPadTextHolder[PipSection.Name.ToString()].text = PipSection.Allocated.ToString(); if (PipSection.Locked) { PipPadTextHolder[PipSection.Name.ToString()].color = Color.black; PipPadImageHolder[PipSection.Name.ToString()].color = Color.black; return; } PipPadTextHolder[PipSection.Name.ToString()].color = Color.black; PipPadImageHolder[PipSection.Name.ToString()].color = Color.grey; float percentageFilled = (float)PipSection.Allocated / (float)PipSection.MaxCap; if (percentageFilled > 0f && percentageFilled < .34f) { PipPadTextHolder[PipSection.Name.ToString()].color = Color.red; PipPadImageHolder[PipSection.Name.ToString()].color = Color.yellow; } if (percentageFilled >= .34f && percentageFilled <= .67f) { PipPadTextHolder[PipSection.Name.ToString()].color = Color.white; // Orange Red https://answers.unity.com/questions/446203/cant-create-orange-label.html PipPadImageHolder[PipSection.Name.ToString()].color = new Color(1.0f, .64f, 0f); } if (percentageFilled > .67f) { PipPadTextHolder[PipSection.Name.ToString()].color = Color.yellow; PipPadImageHolder[PipSection.Name.ToString()].color = Color.red; } }
public void GetBackLoanHealth(PipModel PipSection) { if (PipSection.Allocated <= 0) { return; } playerHealth.LentHp -= PipSection.Allocated; playerHealth.RealHp += PipSection.Allocated; PipSection.Allocated = 0; }
public void MovePips(PipModel PipSection) { if (Updated == null) { throw new ArgumentNullException(nameof(Updated)); } // if there are not enough pips to give or the pip in question is locked or the max cap has been reached, return. if (PipSection.MaxCap <= 0 || PipSection.Locked) { return; } // If the left trigger or num pad plus is held then return all pips if (Refunding) { Damageable.GetBackLoanHealth(PipSection); if (playerHealth.CurHealth > playerHealth.MaxHP) { RectTransform rectTransform = new RectTransform(); for (int tempPipsToAdd = playerHealth.CurHealth - playerHealth.MaxHP; tempPipsToAdd > 0; tempPipsToAdd--) { // Just add the largest key so it is added to the end of the LL. The visuals will be updated later. pipLinkedList.AddNode(new PipNode(PipNode.StatusKey.Damaged)); } } Updated.Invoke(PipSection, PipPadTextHolder, PipPadImageHolder); UpdateHPPips(playerHealth); PipSection.ApplyPipModifications(PlayerCharacter); return; } if (playerHealth.RealHp > playerHealth.MinRealHp && PipSection.Allocated < PipSection.MaxCap) { // Call Pip Display to remove a pip and replace it with an empty one // Call the Damagable script lose a perm health PipSection.Allocated++; Damageable.LoanHealth(1); Updated.Invoke(PipSection, PipPadTextHolder, PipPadImageHolder); PipSection.ApplyPipModifications(PlayerCharacter); } }
public void UpdatePipPad(PipModel pipModel) { Updated.Invoke(pipModel, PipPadTextHolder, PipPadImageHolder); }