| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- /* 野鸡关卡-本地pk模式 */
- public class YejiHuntGameMode_LocalPK : YejiHuntGameMode, ChallengeGameModeLocalPK
- {
- public int currentPlayerIndex = 0; // 双人0和1
- float singleShootReadyTime = 30f;
- float singleShootReadyTimeMax = 30f;
- public YejiHuntGameMode_LocalPK(GameMgr gameMgr) : base(gameMgr) {
- hunterGamePlayerScoreCounter = new HunterGamePlayerScoreCounter(this);
- }
- 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) {
- NextPlayerFinal();
- }
- return canDo;
- }
- void AddReadyView()
- {
- GameObject view = Resources.Load<GameObject>("Prefabs/Views/PKGameReadyView_Challenge");
- GameObject o = GameObject.Instantiate(view);
- PKGameReadyView_Challenge script = o.GetComponent<PKGameReadyView_Challenge>();
- script.currentPlayerIndex = currentPlayerIndex;
- }
- void NextPlayerFinal() {
- NextPlayer();
- BanBowReady();
- AddReadyView();
- }
- void NextPlayer() {
- currentPlayerIndex++;
- currentPlayerIndex %= 2;
- singleShootReadyTime = singleShootReadyTimeMax;
- }
- public override void Update() {
- base.Update();
- if (gameMgr.gameOver || pauseTimeCounting) return;
- singleShootReadyTime -= Time.deltaTime;
- if (singleShootReadyTime <= 0) {
- //切换玩家
- ArmBow.ins.readyShoot();
- NextPlayerFinal();
- }
- }
- //localPK interface
- public int GetCurrentPlayIndex() {
- return currentPlayerIndex;
- }
- public (float, float) GetSingleShootReadyTime() {
- return (singleShootReadyTime, singleShootReadyTimeMax);
- }
- HunterGamePlayerScoreCounter hunterGamePlayerScoreCounter;
- public HunterGamePlayerScoreCounter getHunterGamePlayerScoreCounter() {
- return hunterGamePlayerScoreCounter;
- }
- }
|