V_SMC_Handler.cs 725 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace Visyde{
  6. public class V_SMC_Handler : MonoBehaviour {
  7. public Sprite[] crossHairs;
  8. [HideInInspector]
  9. public int curCrossHair = 0;
  10. // Update is called once per frame
  11. void Update () {
  12. // Roll through the crosshairs list:
  13. if (Input.GetKeyDown (KeyCode.Mouse1)) {
  14. if (curCrossHair < crossHairs.Length - 1) {
  15. curCrossHair += 1;
  16. } else {
  17. curCrossHair = 0;
  18. }
  19. }
  20. // Set the crosshair to the current selected:
  21. GetComponent<Image> ().sprite = crossHairs [curCrossHair];
  22. }
  23. public void ChangeColor (Color color){
  24. this.GetComponent<Image> ().color = color;
  25. }
  26. }
  27. }