RollerController.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class RollerController : MonoBehaviour
  6. {
  7. public GameObject Player;
  8. public Animator Anim;
  9. public MeshRenderer MeshPlayer;
  10. public MeshRenderer MeshPlayerFemale;
  11. public GameObject Roller;
  12. public Transform TrCamera;
  13. void Start()
  14. {
  15. }
  16. void OnDestroy()
  17. {
  18. }
  19. public void Initializaion(GameObject data)
  20. {
  21. MeshPlayer.gameObject.SetActive(false);
  22. MeshPlayerFemale.gameObject.SetActive(false);
  23. Debug.Log("Initializaion " + data);
  24. Player = data;
  25. switch(Core.Instance.CurGender)
  26. {
  27. case Core.Gender.Male:
  28. MeshPlayer.gameObject.SetActive(true);
  29. MeshPlayer.material = data.GetComponentInChildren<Renderer>().material;
  30. break;
  31. case Core.Gender.Female:
  32. MeshPlayerFemale.gameObject.SetActive(true);
  33. MeshPlayerFemale.material = data.GetComponentInChildren<Renderer>().material;
  34. break;
  35. }
  36. Anim.SetBool("Move", true);
  37. }
  38. public void StopRoller()
  39. {
  40. MeshPlayer.gameObject.SetActive(false);
  41. MeshPlayerFemale.gameObject.SetActive(false);
  42. Anim.SetBool("Move", false);
  43. Roller.SetActive(false);
  44. }
  45. }