private void HandleKeyPaintSwitching() { bool pressedKey = false; if (Input.GetKeyDown(KeyCode.Alpha1)) { currentPaintTypeIndex = 0; pressedKey = true; } if (Input.GetKeyDown(KeyCode.Alpha2)) { currentPaintTypeIndex = 1; pressedKey = true; } if (Input.GetKeyDown(KeyCode.Alpha3)) { currentPaintTypeIndex = 2; pressedKey = true; } if (Input.GetKeyDown(KeyCode.Alpha4)) { currentPaintTypeIndex = 3; pressedKey = true; } if (pressedKey) { currentPaintType = (PaintController.PaintType)currentPaintTypeIndex; OnChangeAmmoType(PlayerManager.instance.entity.paintController.GetPaintColor(currentPaintType)); } }
private void PaintController_OnPaintValueReset(PaintController.PaintType paintType) { if (paintType == myPaintType) { paintFillAmount = 0; imageFill.fillAmount = 0; } }
private void PaintController_OnPaintValueModified(PaintController.PaintType paintType, float amount) { if (markHealthText.enabled) { markHealth -= amount; markHealth = Mathf.Clamp(markHealth, 0, 100); markHealthText.text = markHealth + "%"; } }
private void PaintController_OnPaintValueModified(PaintController.PaintType paintType, float amount) { if (capturingPlayer != null && amount > 0) { captureProgress -= (hitProgressLoss / 100 * captureDuration); captureProgress = Mathf.Clamp(captureProgress, 0, captureDuration); captureUIAnim.SetTrigger("Hit"); } }
private void PaintController_OnPaintValueReset(PaintController.PaintType paintType) { for (int i = 0; i < paintUIBars.Count; i++) { if (paintUIBars[i].BarType == paintType) { paintUIBars[i].ResetBar(); } } }
private void PaintController_OnPaintValueModified(PaintController.PaintType paintType, float amount) { if (paintType != myPaintType || PlayerManager.instance.entity.paintController.CurrentPaintMark != null) { return; } paintFillAmount += amount; paintFillAmount = Mathf.Clamp(paintFillAmount, 0, 100); imageFill.fillAmount = paintFillAmount / 100; }
public void Initialise(PaintController.PaintValue paintValue, bool local) { barType = paintValue.paintType; barFillAmount = 0; barColorFill.fillAmount = 0; barColorFill.color = paintValue.paintColor; barBackgroundFill.color = new Color(paintValue.paintColor.r, paintValue.paintColor.g, paintValue.paintColor.b, 0.1f); if (local) { ToggleUI(false); } }
public void Initialise(PaintController.PaintValue paintValue) { myPaintType = paintValue.paintType; paintFillAmount = paintValue.paintValue; for (int i = 0; i < imageBackgrounds.Count; i++) { imageBackgrounds[i].image.color = new Color(paintValue.paintColor.r, paintValue.paintColor.g, paintValue.paintColor.b, imageBackgrounds[i].alpha); } imageFill.color = paintValue.paintColor; imageFill.fillAmount = paintFillAmount / 100; PlayerManager.instance.entity.paintController.OnPaintValueModified += PaintController_OnPaintValueModified; PlayerManager.instance.entity.paintController.OnPaintValueReset += PaintController_OnPaintValueReset; }
private void HandleMousePaintSwitching() { float scroll = Input.GetAxis("Mouse ScrollWheel"); if (scroll == 0) { return; } currentPaintTypeIndex += scroll > 0 ? 1 : 0; currentPaintTypeIndex -= scroll < 0 ? 1 : 0; currentPaintTypeIndex = currentPaintTypeIndex == numOfPaintTypes ? 0 : currentPaintTypeIndex; currentPaintTypeIndex = currentPaintTypeIndex == -1 ? numOfPaintTypes - 1 : currentPaintTypeIndex; currentPaintType = (PaintController.PaintType)currentPaintTypeIndex; OnChangeAmmoType(PlayerManager.instance.entity.paintController.GetPaintColor(currentPaintType)); }
private void PaintController_OnPaintValueModified(PaintController.PaintType paintType, float amount) { if (myEntity.paintController.CurrentPaintMark == null) { for (int i = 0; i < paintUIBars.Count; i++) { if (paintUIBars[i].BarType == paintType) { paintUIBars[i].IncrementBar(amount); } } } else { markPercentageText.text = Mathf.Clamp(myEntity.paintController.CurrentPaintMark.markValue, 0, 100) + "%"; } if (anim) { anim.SetTrigger("Hit"); } }