ArmsManager.cs 774 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ArmsManager : MonoBehaviour {
  5. public GameObject weaponMountPoint;
  6. public Material[] allSkins;
  7. void Start ()
  8. {
  9. if (PlayerSyncLegacy.Instance)
  10. PlayerSyncLegacy.Instance.UpdateCurrentAnimation (this.gameObject.GetComponent <Animation> ());
  11. }
  12. void OnEnable ()
  13. {
  14. if (PlayerSyncLegacy.Instance)
  15. PlayerSyncLegacy.Instance.UpdateCurrentAnimation (this.gameObject.GetComponent <Animation> ());
  16. }
  17. int curSkin = 0;
  18. public void ChangeSkin ()
  19. {
  20. curSkin++;
  21. if (curSkin >= allSkins.Length)
  22. curSkin = 0;
  23. GetComponentInChildren <SkinnedMeshRenderer>().material = allSkins[curSkin];
  24. }
  25. }