using System.Collections; using System.Collections.Generic; using UnityEngine; public class YejiHuntGameMode_LocalPK : YejiHuntGameMode, ChallengeGameModeLocalPK { int currentPlayerIndex = 0; // 双人0和1 public YejiHuntGameMode_LocalPK(GameMgr gameMgr) : base(gameMgr) { } public override void Start() { Yeji.InitPreHeights(); 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; } }