using System.Collections; using System.Collections.Generic; using UnityEngine; public class RabbitHuntGameMode_LocalPK : RabbitHuntGameMode, ChallengeGameModeLocalPK { int currentPlayerIndex = 0; // 双人0和1 public RabbitHuntGameMode_LocalPK(GameMgr gameMgr) : base(gameMgr) { } public override void Start() { SetLevel(5); AddHuntGameView(); this.gameMgr.transform.Find("HunterGameView_LocalPK").gameObject.SetActive(true); AddReadyView(); } public override bool DoNextShoot() { bool canDo = base.DoNextShoot(); if (canDo) { NextPlayer(); BanBowReady(); AddReadyView(); } return canDo; } void AddReadyView() { GameObject view = Resources.Load("Prefabs/Views/PKGameReadyView_Challenge"); GameObject o = GameObject.Instantiate(view); PKGameReadyView_Challenge script = o.GetComponent(); script.currentPlayerIndex = currentPlayerIndex; } void NextPlayer() { currentPlayerIndex++; currentPlayerIndex %= 2; } //localPK interface public int GetCurrentPlayIndex() { return currentPlayerIndex; } } public interface ChallengeGameModeLocalPK { public int GetCurrentPlayIndex(); }