HumanoidPartShotTarget.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace ShotSimulator.Target
  5. {
  6. public enum HumanoidPartType
  7. {
  8. Head,
  9. Body
  10. }
  11. public class HumanoidPartShotTarget : BaseShotTarget
  12. {
  13. [SerializeField]
  14. private HumanoidPartType m_HumanoidPartType;
  15. [SerializeField]
  16. private HumanoidShotTarget m_HumanoidShotTarget;
  17. [SerializeField]
  18. private SkinnedMeshRenderer skinnedMeshRenderer;
  19. [SerializeField]
  20. private int partMaterialIndex;
  21. public HumanoidShotTarget DependTarget
  22. {
  23. get { return m_HumanoidShotTarget; }
  24. }
  25. public HumanoidPartType PartType
  26. {
  27. get { return m_HumanoidPartType; }
  28. }
  29. public override void OnClick()
  30. {
  31. if (!IsRunning) return;
  32. base.OnClick();
  33. m_HumanoidShotTarget.CauseHumanoidPartReduceHP(this);
  34. }
  35. public void SetColor(Color color)
  36. {
  37. skinnedMeshRenderer.materials[partMaterialIndex].color = color;
  38. }
  39. }
  40. }