예제 #1
0
    public void SpawnPlayerDaoDan(XkPlayerCtrl script)
    {
//		if (DaoJiShiCtrl.GetInstance().GetIsPlayDaoJishi()) {
//			XkGameCtrl.IsActivePlayerOne = DaoJiShiCtrl.IsActivePlayerOne;
//			XkGameCtrl.IsActivePlayerTwo = DaoJiShiCtrl.IsActivePlayerTwo;
//			DaoJiShiCtrl.GetInstance().StopDaoJiShi();
//		}

        if (PlayerDaoDan != null && script != null)
        {
            int max = AmmoPointTran.Length;
            for (int i = 0; i < max; i++)
            {
                if (!AmmoPointTran [i].gameObject.activeSelf)
                {
                    continue;
                }
                AmmoPointTran [i].gameObject.SetActive(false);
                script.SpawnPlayerDaoDan(AmmoPointTran [i], PlayerDaoDan);
            }
        }

        if (Network.peerType == NetworkPeerType.Disconnected || Network.peerType == NetworkPeerType.Server)
        {
            Invoke("DelayShowPlayerFinishTask", TimeGameOver);
        }
    }
    /// <summary>
    /// 循环产生空袭导弹.
    /// </summary>
    IEnumerator LoopSpawnKongXiDaoDan(GameObject playerDaoDan)
    {
        bool isDamagePlayer = false;

        do
        {
            if (KongXiDt.IsRemoveKongXiZuDang)
            {
                Debug.Log("LoopSpawnKongXiDaoDan -> stop!");
                yield break;
            }

            Debug.Log("LoopSpawnKongXiDaoDan -> time " + Time.time);
            int max = KongXiDt.AmmoPointTr.Length;
            for (int i = 0; i < max; i++)
            {
                if (mPlayerScript != null && KongXiDt.AmmoPointTr[i] != null)
                {
                    KongXiDt.AmmoPointTr[i].gameObject.SetActive(false);
                    mPlayerScript.SpawnPlayerDaoDan(KongXiDt.AmmoPointTr[i], playerDaoDan);
                }
            }

            if (!isDamagePlayer)
            {
                Vector3 pos1 = KongXiDt.KongXiDianObj.transform.position;
                Vector3 pos2 = XkPlayerCtrl.GetInstanceTanKe().transform.position;
                pos1.y = pos2.y = 0f;
                if (Vector3.Distance(pos1, pos2) <= KongXiDt.DamageDis)
                {
                    isDamagePlayer = true;
                    XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerOne, KongXiDt.PlayerDamage);
                    XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerTwo, KongXiDt.PlayerDamage);
                    if (GameUICenterCtrl.GetInstance() != null)
                    {
                        GameUICenterCtrl.GetInstance().RemoveKongXiZuDangUI();
                        GameUICenterCtrl.GetInstance().RemoveKongXiShanHongUI();
                        GameUICenterCtrl.GetInstance().RemoveKongXiDaoJishiUI();
                        GameUICenterCtrl.GetInstance().SpawnKongXiJiZhongUI();
                    }

                    if (mPlayerScript.GetPlayerCameraScript() != null)
                    {
                        //画面开始变黑白.
                        mPlayerScript.GetPlayerCameraScript().mCameraColorChange.Init();
                    }
                }
            }
            yield return(new WaitForSeconds(KongXiDt.TimeLoopDaoDan));
        }while (!KongXiDt.IsRemoveKongXiZuDang);
    }
예제 #3
0
    void SpawnPlayerDaoDan(XkPlayerCtrl script, GameObject playerDaoDan)
    {
        int max = AmmoPointTran.Length;

        for (int i = 0; i < max; i++)
        {
            if (!AmmoPointTran[i].gameObject.activeSelf)
            {
                continue;
            }
            AmmoPointTran[i].gameObject.SetActive(false);
            script.SpawnPlayerDaoDan(AmmoPointTran[i], playerDaoDan);
        }
    }