protected virtual void InitIndicator() { if (null == _IndicatorEffect) { _IndicatorEffect = GraphicsTools.ManualCreateObject("TempArtist/Prefab/Particle/S_Point", "Indicator", true); } // if (null == _mRoute) // { // _mRoute = GraphicsTools.ManualCreateObject("Common/Route", "Route"); // } }
protected virtual GameObject CreateRandomChest(int chestID) { GameObject go = GraphicsTools.ManualCreateObject("TempArtist/Prefab/Build/m_other_box", "Chest" + chestID.ToString(), true); ChestTrigger trigger = go.AddComponent <ChestTrigger>() as ChestTrigger; trigger.ChestID = chestID; int index = Random.Range(0, _mChestPosList.Length); go.transform.position = _mChestPosList[index]; _mChestList.Add(chestID, go); // Globals.Instance.MGUIManager.GetGUIWindow<GUIMain>().UpdateCopyChestShow(_mChestList.Count); return(go); }
public override void Initialize() { // Get the FingerEvent Component, Register FingerEventListener Globals.Instance.MFingerEvent.Add3DEventListener(this); SetFingerEventActive(true); mFormerCameraPos = Globals.Instance.MSceneManager.mMainCamera.transform.position; mFormerCameraEular = Globals.Instance.MSceneManager.mMainCamera.transform.eulerAngles; // find the right dock position // GameObject port = GameObject.Find("Scene/m_other_Wharf"); if (port == null) { throw new System.Exception("GameObject.Find(\"Scene/m_other_Wharf\") == null"); } Transform cameraPos = port.transform.Find("CameraPostion"); Globals.Instance.MSceneManager.mMainCamera.transform.position = cameraPos.position; Globals.Instance.MSceneManager.mMainCamera.transform.eulerAngles = cameraPos.eulerAngles; // find the right dock warship position // mPlayerDockPos.Clear(); int index = 1; while (index < 10) { Transform pos = port.transform.Find("postion0" + index); if (pos == null) { break; } mPlayerDockPos.Insert(0, pos.position); index++; } // open the GUIPlayerDock // GUIRadarScan.Show(); bool playerDockState = GameStatusManager.Instance.EnterPKBattleByPlayerDock; //Globals.Instance.MGUIManager.CreateWindow<GUIPlayerDock>(delegate(GUIPlayerDock gui){ // // if(playerDockState){ // ShowPlayerWarship(mCurrPageIndex); // }else{ // NetSender.Instance.RequestPlayerDock(); // } //}); // create the selected player effect // if (mSelectedEffect == null) { mSelectedEffect = GraphicsTools.ManualCreateObject("TempArtist/Prefab/Particle/S_Point", "Indicator", true);; mSelectedEffect.SetActiveRecursively(false); } }
protected virtual void OnBattleEnd_impl(GameData.BattleGameData.BattleResult battleResult) { // Resume the camera Globals.Instance.MSceneManager.mMainCamera.transform.position = _mCurrentCamPos; Globals.Instance.MSceneManager.mMainCamera.transform.forward = _mCurrentCamForward; // resume trigger battle, and close Input SetEnabled(true); SetFingerEventActive(true); _mIsPermitRequestBattle = true; // Clear ReinforcementData Globals.Instance.MGameDataManager.MActorData.RemoveReinforcementData(); Vector3 monsterPos = Vector3.zero; switch (battleResult.BattleWinResult) { // Actor win case GameData.BattleGameData.EBattleWinResult.ACTOR_WIN: { // Destroy the guide DestroyGuideArrows(_mFightingMonsterFleet); // Destroy the failed Fleet according to BattleResult monsterPos = _mFightingMonsterFleet.Position; _mMonsterFleetList.Remove(_mFightingMonsterFleet); Globals.Instance.MPlayerManager.RemoveMonsterFleet(_mFightingMonsterFleet); _mFightingMonsterFleet = null; // Create a random chest if (battleResult.ChestID != -1) { GameObject go = CreateRandomChest(battleResult.ChestID); go.transform.position = monsterPos; } // Single Drap information OnceBattleFinish(); break; } // Dogfall case GameData.BattleGameData.EBattleWinResult.DOGFALL: { // Destroy the guide DestroyGuideArrows(_mFightingMonsterFleet); // Destroy the failed Fleet according to BattleResult monsterPos = _mFightingMonsterFleet.Position; _mMonsterFleetList.Remove(_mFightingMonsterFleet); Globals.Instance.MPlayerManager.RemoveMonsterFleet(_mFightingMonsterFleet); _mFightingMonsterFleet = null; // Create a random chest if (battleResult.ChestID != -1) { GameObject go = CreateRandomChest(battleResult.ChestID); go.transform.position = monsterPos; } break; } // Monster win case GameData.BattleGameData.EBattleWinResult.MONSTER_WIN: { // tzz added // move the warship by monster collider bounds to avoid the fight immedately again // Vector3 t_monsterSize = _mFightingMonsterFleet.m_battleTrigger.GetComponent <Collider>().bounds.size; // increase some distance t_monsterSize.x += 50; // get the own actor ship position Vector3 t_ownPos = Vector3.zero; foreach (WarshipL ws in _mActorFleet._mWarshipList) { t_ownPos = ws.U3DGameObject.transform.position; break; } // monster(Enemy) position Vector3 t_monsterPos = _mFightingMonsterFleet.m_copyStatusGameObject.transform.position; // actor direct back position Vector3 t_direclyBackPos = t_monsterPos + ((t_ownPos - t_monsterPos).normalized * t_monsterSize.x); Vector2[] t_restPos = { new Vector2(t_direclyBackPos.x, t_direclyBackPos.z), new Vector2(t_monsterPos.x + t_monsterSize.x, t_monsterPos.z), new Vector2(t_monsterPos.x - t_monsterSize.x, t_monsterPos.z), new Vector2(t_monsterPos.x, t_monsterPos.z + t_monsterSize.x), new Vector2(t_monsterPos.x, t_monsterPos.z - t_monsterSize.x), }; foreach (Vector2 pos in t_restPos) { if (crossArea.Contains(pos)) { // rest position is in the cross Area // foreach (WarshipL ws in _mActorFleet._mWarshipList) { ws.ForceMoveTo(new Vector3(pos.x, t_ownPos.y, pos.y)); } break; } } Statistics.INSTANCE.CustomEventCall(Statistics.CustomEventType.FailedCopyBattle, "CopyID", Globals.Instance.MGameDataManager.MCurrentCopyData.MCopyBasicData.CopyID); break; } } // Flush ship life Dictionary <long, GirlData> dictWarshipData = Globals.Instance.MGameDataManager.MActorData.GetWarshipDataList(); List <GameData.BattleGameData.WarshipBattleEndCurrLife> listWarshipLife = GameStatusManager.Instance.MBattleStatus.MBattleResult.ListWarshipBattleEndCurrLife; foreach (GameData.BattleGameData.WarshipBattleEndCurrLife warshipLife in listWarshipLife) { if (dictWarshipData.ContainsKey(warshipLife.ShipID)) { dictWarshipData[warshipLife.ShipID].PropertyData.Life = warshipLife.ShipCurrLife; } } // Globals.Instance.MGameDataManager.MActorData.NotifyWarshipUpdate(); Debug.Log("copystatas"); Globals.Instance.M3DItemManager.PlayBattleEffect(battleResult, delegate(){ Globals.Instance.MGUIManager.CreateWindow <GUISingleDrop>(delegate(GUISingleDrop gui) { gui.UpdateData(); }); }); if (battleResult.IsFinalBattle) { _mIsFinalBattle = true; GameObject go = GraphicsTools.ManualCreateObject("TempArtist/Prefab/Particle/S_LeaveCopy", "LeaveTrigger", false); float y = go.transform.position.y; LeaveCopyTrigger trigger = go.AddComponent <LeaveCopyTrigger>() as LeaveCopyTrigger; go.transform.position = new Vector3(monsterPos.x, y, monsterPos.z); go.transform.localScale = Vector3.one; mLeaveTrigger = go.transform.position; // DisplayCopyDrops(); } }