YejiHuntGameMode_LocalPK.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class YejiHuntGameMode_LocalPK : YejiHuntGameMode, ChallengeGameModeLocalPK
  5. {
  6. int currentPlayerIndex = 0; // 双人0和1
  7. public YejiHuntGameMode_LocalPK(GameMgr gameMgr) : base(gameMgr) {
  8. }
  9. public override void Start()
  10. {
  11. Yeji.InitPreHeights();
  12. SetLevel(5);
  13. AddHuntGameView();
  14. this.gameMgr.transform.Find("HunterGameView_LocalPK").gameObject.SetActive(true);
  15. AddReadyView();
  16. }
  17. public override bool DoNextShoot() {
  18. bool canDo = base.DoNextShoot();
  19. if (canDo) {
  20. NextPlayer();
  21. BanBowReady();
  22. AddReadyView();
  23. }
  24. return canDo;
  25. }
  26. void AddReadyView()
  27. {
  28. GameObject view = Resources.Load<GameObject>("Prefabs/Views/PKGameReadyView_Challenge");
  29. GameObject o = GameObject.Instantiate(view);
  30. PKGameReadyView_Challenge script = o.GetComponent<PKGameReadyView_Challenge>();
  31. script.currentPlayerIndex = currentPlayerIndex;
  32. }
  33. void NextPlayer() {
  34. currentPlayerIndex++;
  35. currentPlayerIndex %= 2;
  36. }
  37. //localPK interface
  38. public int GetCurrentPlayIndex() {
  39. return currentPlayerIndex;
  40. }
  41. }