/// <summary> /// 显示传送点 /// </summary> /// <param name="grid"></param> public void ShowTranGate(Int2 grid) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { Vector3 vEndEff = Vector3.zero; if (RoomMap.CheckHaveMap() == true) { vEndEff = RoomMap.GetRoomGridLocalPos(grid); } else { vEndEff = GenerateShip.GetbuildPos(grid); } vEndEff = U3DUtil.AddX(vEndEff, 1.0f); if (go1903041) { go1903041.SetActive(true); go1903041.transform.localPosition = vEndEff; if (go1903041.GetComponent <NdHide>() != null) { go1903041.GetComponent <NdHide>().ResetDuration(3f); } } } }
public void SetUI() { string [] l = m_shape.Split(','); m_height = l.Length; for (int i = 0; i < l.Length; i++) { for (int j = 0; j < l[i].Length; j++) { GameObject go = NDLoad.LoadWndItem("ShipModelItem", TableList[i].transform); if (go != null) { ShipModelItem item = go.GetComponent <ShipModelItem>(); if (item != null) { if (l[i][j] == '1') { item.SetSize(GetSingleWidth(), GetSingleWidth()); } //有可能是甲板层. else if (l[i][j] == '0') { //如果他的下一层不为0则是甲板层. bool deck = BattleEnvironmentM.CheckIsDeckGrid(l, i, j); item.SetSize(GetSingleWidth(), GetSingleWidth(), deck); item.gameObject.SetActive(deck); } } } } TableList[i].Reposition(); TableList[i].repositionNow = true; } StartCoroutine(RepositionTable(1)); }
public void GoldCoinEffect(int num, int count) { for (int i = 0; i < num; i++) { Vector3 pos = MapGrid.GetMG(m_Attr.Pos).pos; //+new Vector3(Random.Range(1,m_Attr.Size*0.5f-2),-0.5f,1f); pos += new Vector3(0, 0.25f, 1.2f); pos = BattleEnvironmentM.Local2WorldPos(pos); int n = (int)count / num; if (i == 0) { n += count - num * ((int)count / num); } GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000041", EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); //EffectCamera.AddFollowList(gae.transform,pos); if (gae != null) { GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0)); gae.AddAction(gaw); GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI(); gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, ResourceType.Gold); gae.AddAction(gar); GameObject coin = U3DUtil.FindChild(gae.gameObject, "coin"); if (coin != null) { coin.GetComponent <ParticleSystem>().startDelay = Random.Range(1f, 1.5f); } } } }
public void shake(Vector3 pos) { Vector3 localpos = BattleEnvironmentM.World2LocalPos(pos); int item = Mathf.FloorToInt(localpos.x / MapGrid.m_width) - StartUnit; if (item >= 0 && item < MapGrid.m_UnitRoomGridNum ) { } for (int i = 1; i <= 3; i ++) { GameObject go = null; int left = item - i; if (left >= 0) { go = itemfloor[left]; } else if (m_Left != null) { go = m_Left.itemfloor[MapGrid.m_UnitRoomGridNum + left]; } if (go != null ) { } int right = item + i; if (right < MapGrid.m_UnitRoomGridNum) { go = itemfloor[right]; } else if (m_Right != null) { go = m_Right.itemfloor[right - MapGrid.m_UnitRoomGridNum]; } if (go != null ) { } } }
public void DoEvent(UIButton sender) { BattleEnvironmentM.SetBattleEnvironmentMode(BattleEnvironmentMode.CombatPVE); //获取关卡信息 StageDC.SetCompaignStage(m_Type, m_StageID); SceneM.Load(ViewStageScene.GetSceneName(), false, false); }
/// <summary> /// 设置拳击击飞Action(击飞状态下不拥有炮战技能) /// </summary> /// <returns></returns> public void SetHitFly(WalkDir Dir, float duration, float delay, bool bearhit) { m_FlyInfo.flyCollisionAction = FlyCollisionAction.DropOutBoat; Vector3 Target = BattleEnvironmentM.GetHitFlyEndPoint(m_Owner.m_thisT.position, Dir, bearhit); CurrentAction = new GridActionCmdHitFly(m_Owner, Target, duration, Dir, delay, bearhit); }
static void DropResourceBoxEffect(string name, sdata.s_itemtypeInfo item, Vector3 pos) { pos = BattleEnvironmentM.Local2WorldPos(pos); pos.x += 0.5f; pos.z = 0; GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", name, EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); EffectCamera.AddFollowList(gae.transform, pos); if (gae != null) { //先等待 GameObjectActionBoxWait gaw = new GameObjectActionBoxWait(2f); gae.AddAction(gaw); //open box GameObjectActionOpenBox gaopen = new GameObjectActionOpenBox(2.0f, item); gae.AddAction(gaopen); Animator ani = gae.gameObject.GetComponent <Animator>(); if (null != ani) { int nValue = (int)Random.value % 2; if (nValue == 0) { nValue = 2; } ani.SetInteger("iState", nValue); } } }
void OnDrawGizmos() { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { List <RoomGrid> list = new List <RoomGrid>(); list = RoomMap.GetAllRoomGrid(); if (list.Count == 0) { return; } foreach (RoomGrid p in list) { p.DrawRoomGridInfo(); } } else { List <MapGrid> lg = new List <MapGrid>(); MapGrid.GetMapGridList(ref lg); foreach (MapGrid m in lg) { DrawMapGrid(m, m.GridPos.Unit); } } //GenerateShip.DrawRejectPolygon (); }
/// <summary> /// 进攻防守阵营转是否玩家 /// </summary> public static bool GetCamp2Player(LifeMCamp Camp) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE && StageDC.GetPveMode() == PVEMode.Defense) { if (Camp == LifeMCamp.ATTACK) { return(false); } else { return(true); } } else { if (Camp == LifeMCamp.ATTACK) { return(true); } else { return(false); } } }
public void DrawRoomGridInfo() { #if UNITY_EDITOR Vector3 pos = BattleEnvironmentM.Local2WorldPos(LocalPos); pos.x += m_width / 2; pos.y -= 0.3f; GUIStyle style = new GUIStyle(); style.normal.textColor = Color.green; int value = m_CanPosition - m_Position; Handles.Label(pos, value.ToString(), style); pos.y += 1.5f; pos.x -= 0.5f; Vector2 v = new Vector2(LocalPos.x, LocalPos.y); style.normal.textColor = Color.red; Handles.Label(pos, v.ToString(), style); /* * if(IsDeckRoom == true) * { * pos.y -= 0.5f; * style.normal.textColor = Color.yellow; * Handles.Label(pos, "DeckRoom", style); * }*/ #endif }
void BtnStage_OnClickEventHandler(UIButton sender) { BattleEnvironmentM.SetBattleEnvironmentMode(BattleEnvironmentMode.CombatPVE); //获取关卡信息 StageDC.SetCompaignStage(m_type, m_StageID); SceneM.Load(ViewStageScene.GetSceneName(), false, null, false); }
/// <summary> /// 播放特效 /// </summary> public void PlayTrapEffect(string effectName, float deadtime) { if (m_building == null) { return; } if (m_building.m_roomType == RoomType.ResRoom) { return; } Vector3 Pos = GetWorldPos(); if (effectName == "2000651") { Pos.z -= 10; Pos.x -= MapGrid.m_width / 2; Pos.y = Pos.y - MapGrid.m_heigth / 2 + 0.3f; } else { Pos.z -= 1; } GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", effectName, Pos, BattleEnvironmentM.GetLifeMBornNode(true)); if (gae != null) { GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(deadtime); gae.AddAction(ndEffect); } }
/// <summary> /// 设置物品掉落奖励 /// </summary> public static void SetRewardItew() { if (BattleEnvironmentM.GetBattleEnvironmentMode() != BattleEnvironmentMode.CombatPVE) { return; } if (StageDC.GetPveMode() == PVEMode.Attack) { foreach (SoldierInfo Info in m_DefenseList.Values) { if (Info != null) { Info.SetRewardItems(StageDC.GetMonsterReward(Info.SoldierTypeID)); } } } else { foreach (SoldierTypeInfo s in m_AttackList.Values) { if (s != null && s.m_Soldier != null) { s.m_Soldier.SetRewardItems(StageDC.GetMonsterReward(s.m_Soldier.SoldierTypeID)); } } } }
void DoSkill1028(MapGrid pos, SoldierSkill skill) { if (pos == null) { return; } GameObject posgo = m_LifePrent.GetSkin().ProPerty.HelpPoint.GetVauleByKey(HelpPointName.FirePos); Transform fireplace = posgo.transform; if (fireplace != null) { string bulletname = "1003051"; GameObject go = GameObjectLoader.LoadPath("effect/prefab/", bulletname, BattleEnvironmentM.GetLifeMBornNode(true)); go.transform.position = fireplace.position; if (m_LifePrent.WalkDir == WalkDir.WALKRIGHT) { go.transform.localScale = new Vector3(-go.transform.localScale.x, go.transform.localScale.y, go.transform.localScale.z); } Bullet bullet = go.AddComponent <Bullet>(); if (bullet != null) { Bullet.BulletType t = Bullet.BulletType.bomb1028; Vector3 vpos = pos.pos; vpos.y = go.transform.localPosition.y; bullet.SetInfo(vpos, m_DoAttack, 10f, m_LifePrent.WalkDir, t, skill); } } }
/// <summary> /// 是否玩家转进攻防守阵营 /// </summary> public static LifeMCamp GetPlayer2Camp(bool IsPlayer) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE && StageDC.GetPveMode() == PVEMode.Defense) { if (IsPlayer == true) { return(LifeMCamp.DEFENSE); } else { return(LifeMCamp.ATTACK); } } else { if (IsPlayer == true) { return(LifeMCamp.ATTACK); } else { return(LifeMCamp.DEFENSE); } } }
public static void ReBuildShip() { U3DUtil.DestroyAllChild(m_MapStart.gameObject); Int2 roomGrid = new Int2(); switch (m_SceneState) { case TreasureState.None: case TreasureState.CanvasEdit: { ShipPlan plan = ShipPlanDC.GetCurShipPlan(); if (plan != null) { roomGrid = plan.Canvans.GetMapSize(); BattleEnvironmentM.ResetStartPos(plan.Canvans.GetMapSize(), true); } GenerateShip.GenerateShips(m_MapStart); break; } } Vector3 pos = MainCameraM.GetMainCameraPos(roomGrid); MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidBoatView); MainCameraM.s_Instance.AutoMoveTo(pos, 0f); }
void GoCombat() { SoundPlay.PlayBackGroundSound("bgm_battle_loop", true, false); List <int> l = new List <int>(); List <int> lDefense = new List <int>(); List <SoldierInfo> soldierList = new List <SoldierInfo>(); foreach (var i in m_SelectedSoldier) { soldierList.Add(SoldierDC.GetSoldiers(i.Soldier.ID)); l.Add(i.Soldier.ID); lDefense.Add(i.Soldier.SoldierTypeID); } CmCarbon.SetAttackSoldier(soldierList); if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE) { /*if (StageDC.GetPveMode() == PVEMode.Defense) { * StageDC.SendStageAttackRequest(StageDC.GetCompaignStageID(), lDefense, 0); * } else { * StageDC.SendStageAttackRequest(StageDC.GetCompaignStageID(), l, m_SelectedBlackScienceDataID); * } * DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_702, CanCombat);*/ JoinCombat(); } else { JoinCombat(); } }
void BtnReturn_OnClickEventHandler(UIButton sender) { U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject); WndManager.DestroyAllDialogs(); BoatObj.SendGetPlanData(); TreasureScene.OutTreasureScene(); }
public Vector3 GetMouseGridPos() { Vector3 v3TouchScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, -Camera.main.transform.position.z); Vector3 v3TouchWorldPos = Camera.main.ScreenToWorldPoint(v3TouchScreenPos); Vector3 gridPos = BattleEnvironmentM.World2LocalPos(v3TouchWorldPos); return(gridPos); }
void CANVANS_BUILDING_INFO_RESP(int nErrorCode) { if (nErrorCode == 0) { //加载画布和建筑 RoomMap.CreateCanvansArea(); BattleEnvironmentM.BuildScene(); } }
public override void WndStart() { base.WndStart(); int countDown = ConfigM.GetAttackCountDown(BattleEnvironmentM.GetBattleEnvironmentMode()); SetAttackTime(countDown); AddEvents(); StartAttackCountDown(); }
public void StartInit() { name = transform.name; m_tStart = BattleEnvironmentM.GetLifeMBornNode(true); m_ani = GetComponent <Animation>(); if (m_Core.m_type != ShipBuildType.BuildStair) { InitTrapRoomUI(); } }
public void SetData(CounterBubblePromtInfo info) { Transform tStart = BattleEnvironmentM.GetLifeMBornNode(true); if (tStart != null) { NGUIUtil.Set3DUIPos(gameObject, new Vector3(info.x + tStart.position.x, info.y + tStart.position.y, 0f)); } NGUIUtil.SetLableText(LblText, info.text); }
//播放区块中心爆炸效果 private void PlayStep3(string effectName, float deadtime) { Vector3 pos = Vector3.zero; foreach (BombPoint B in m_start) { if (B != null) { pos += B.GetWorldPos(); } } foreach (BombPoint B in m_linkPoint) { if (B != null) { pos += B.GetWorldPos(); } } int total = m_start.Count + m_linkPoint.Count; if (total != 0) { pos = pos / total; GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", effectName, pos, BattleEnvironmentM.GetLifeMBornNode(true)); if (gae != null) { GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(deadtime); gae.AddAction(ndEffect); } } //房间爆炸掉 DestroyRoom(); if (ProcessType == BombProcessType.End) { //if(m_linkCenterPoint == null || m_linkCenterPoint.Count == 0) { List <Life> l = new List <Life>(); CM.SearchLifeMListInBoat(ref l, LifeMType.BUILD, LifeMCamp.DEFENSE); foreach (Life b in l) { if (b == null) { continue; } if (b is Building && (b as Building).m_roomType == RoomType.NormalTrap) { (b as Building).KillSelf(0); } } } } }
/// <summary> /// 防御战 战前警报 “感叹号”敌方飞入点提示 /// </summary> private void PlayEnemyFlyHitPoint(Vector3 pos) { pos = U3DUtil.SetZ(pos, -1f); //保证特效在炮弹兵前 GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000501_02", pos, BattleEnvironmentM.GetLifeMBornNode(true)); if (gae != null) { GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f); gae.AddAction(ndEffect); } }
void Start() { if ((BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE && StageDC.GetPveMode() == PVEMode.Defense) || !m_isPlayer) { ShowHpAnger(true); } else { ShowHpAnger(false); } }
void Start() { _Mapboat = this; if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { EnableBoatAnimator(false); } else { //CreateRejectPolygon (); } }
public void DoReturnMainTown() { U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject); WndManager.DestroyAllDialogs(); BoatObj.SendGetPlanData(); MainCameraM.s_Instance.EnableOthOn(false); MainCameraM.s_Instance.ResetCameraDataByHaven(); MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidHavenView); MainTownScene.RevertFrCamPosTemp(); }
/// <summary> /// 碰撞器管理 /// </summary> public void EnableColider(ColiderType Type, bool bEnable) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { return; } if (ProPerty.m_roleColider != null) { ProPerty.m_roleColider.EnableColider(Type, bEnable); } }
/// <summary> /// 出生构造函数 /// </summary> /// <param name="Parent">出生角色</param> /// <param name="JumpTarget">跳跃的位置</param> /// <param name="JumpDir">朝向</param> /// <param name="dcb">完成回调</param> public BornActionCmd(Life Parent, Vector3 JumpTarget, WalkDir JumpDir, DoneCallBack dcb, float duration, AnimatorState state, bool bFallSmooth, string strBornEffect) { SetTarget(Parent); Transform t = m_Skin.tRoot; t.parent = BattleEnvironmentM.GetLifeMBornNode(true); m_Start = t.localPosition; m_PauseRotation = t.localRotation; m_End = JumpTarget; if (Parent.m_Attr.AttrType == 102003 || Parent.m_Attr.AttrType == 200009) { if (Parent.Anger <= 0) { t.localPosition = m_End; (Parent as Role).TurnsInto(false); m_Skin = Parent.GetSkin(); Vector3 pos = m_Skin.tRoot.position; pos.z -= 2f; GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, Parent.m_Attr.AttrType == 102003 ? "1103111_01":"1401111_01", pos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.0f); gae.AddAction(ndEffect); } } else if (Parent.m_Attr.AttrType == 101004) { Vector3 pos = m_Skin.tRoot.position; GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "1055021", pos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.0f); gae.AddAction(ndEffect); } m_doneCallBack = dcb; m_Dir = JumpDir; m_Duration = duration; m_state = state; m_fPauseTime = 0f; //RolePlayAnimation(AnimatorState.Stand); //SetBornActionCmd(); if (!bFallSmooth) { m_Start = JumpTarget; } m_Skin.tRoot.rotation = Quaternion.identity; GameObject posgo = m_Skin.ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectPos); if (posgo != null && strBornEffect.Length > 0) { Vector3 pos = posgo.transform.position; GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, strBornEffect, pos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(duration); gae.AddAction(ndEffect); } }