RabbitHuntGameMode_LocalPK.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class RabbitHuntGameMode_LocalPK : RabbitHuntGameMode
  5. {
  6. int currentPlayerIndex = 0; // 双人0和1
  7. public RabbitHuntGameMode_LocalPK(GameMgr gameMgr) : base(gameMgr) {
  8. }
  9. public override void Start()
  10. {
  11. SetLevel(5);
  12. AddHuntGameView();
  13. AddReadyView();
  14. }
  15. public override bool DoNextShoot() {
  16. bool canDo = base.DoNextShoot();
  17. if (canDo) {
  18. NextPlayer();
  19. BanBowReady();
  20. AddReadyView();
  21. }
  22. return canDo;
  23. }
  24. void AddReadyView()
  25. {
  26. GameObject view = Resources.Load<GameObject>("Prefabs/Views/PKGameReadyView_Challenge");
  27. GameObject o = GameObject.Instantiate(view);
  28. PKGameReadyView_Challenge script = o.GetComponent<PKGameReadyView_Challenge>();
  29. script.currentPlayerIndex = currentPlayerIndex;
  30. }
  31. void NextPlayer() {
  32. currentPlayerIndex++;
  33. currentPlayerIndex %= 2;
  34. }
  35. }