YejiHuntGameMode_LocalPK.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class YejiHuntGameMode_LocalPK : YejiHuntGameMode
  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. AddReadyView();
  15. }
  16. public override bool DoNextShoot() {
  17. bool canDo = base.DoNextShoot();
  18. if (canDo) {
  19. NextPlayer();
  20. BanBowReady();
  21. AddReadyView();
  22. }
  23. return canDo;
  24. }
  25. void AddReadyView()
  26. {
  27. GameObject view = Resources.Load<GameObject>("Prefabs/Views/PKGameReadyView_Challenge");
  28. GameObject o = GameObject.Instantiate(view);
  29. PKGameReadyView_Challenge script = o.GetComponent<PKGameReadyView_Challenge>();
  30. script.currentPlayerIndex = currentPlayerIndex;
  31. }
  32. void NextPlayer() {
  33. currentPlayerIndex++;
  34. currentPlayerIndex %= 2;
  35. }
  36. }