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 }
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); } } } }
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 PlayDuskAtGrid(Int2 grid) { Vector3 localPos = RoomMap.GetRoomGridLocalPos(grid); Vector3 pos = BattleEnvironmentM.Local2WorldPos(localPos); pos = U3DUtil.AddZ(pos, 5f);//在建筑后面播放 pos = U3DUtil.AddX(pos, RoomGrid.m_width / 2.0f); pos = U3DUtil.AddY(pos, RoomGrid.m_heigth / 2.0f); GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "2000391", pos, m_tStart); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.0f); gae.AddAction(ndEffect); }
void OnDrawGizmos() { Gizmos.color = Color.red; if (myBezier != null) { string str = "start:"; for (float i = 0; i <= 1; i += 0.01f) { str += myBezier.GetPointAtTime(i) + ", "; Vector3 s = myBezier.GetPointAtTime(i); Vector2 e = myBezier.GetPointAtTime(i + 0.01f); Gizmos.DrawLine(BattleEnvironmentM.Local2WorldPos(s), BattleEnvironmentM.Local2WorldPos(e)); } //Debug.Log(str); } }
static void DropResourceEffect(string name, ResourceType t, int num, int count, Vector3 pos) { pos = BattleEnvironmentM.Local2WorldPos(pos); pos.x -= num / 2f; for (int i = 0; i < num; i++) { int n = (int)count / num; if (i == 0) { n += count - num * ((int)count / num); } pos.x += 1; //Random.Range(0,2) == 0 ? - Random.Range(0,0.5f*num):Random.Range(0,0.5f*num); pos.z = 0; GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", name, EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); //EffectCamera.AddFollowList(gae.transform,pos); if (gae != null) { Random.seed++; 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, t); gae.AddAction(gar); Animator ani = gae.gameObject.GetComponent <Animator>(); if (null != ani) { int nValue = (int)Random.value % 2; if (nValue == 0) { nValue = 2; } ani.SetInteger("iState", nValue); } } } }
public override void UpdatePos() { if (m_TimeCount < m_CastTime) { PlayAction(AnimatorState.PreSkill01, m_Skin.tRoot.localPosition); } else if (m_TimeCount < m_EventTime) //m_action3 ) //if ((m_TimeCount-m_Delatime) < m_CastTime) { (m_Skin as RoleSkin).SetVisable(false); //m_bodyobj.SetActive(false); if (lpos.Count > 0) { float timecout = m_TimeCount - m_CastTime; if (timecout >= m_oncejumptime * m_JumpCount) { if (timecout >= lpos.Count - 1) { timecout = lpos.Count - 2; } Vector3 pos = Vector3.Lerp(lpos[m_JumpCount], lpos[m_JumpCount + 1], (timecout - m_oncejumptime * m_JumpCount) / m_oncejumptime); if (m_gs == GridSpace.Space_DOWN) { PlayAction(AnimatorState.JumpUp, pos, true); } else { PlayAction(AnimatorState.JumpDown, pos, true); } if (timecout >= m_oncejumptime * (m_JumpCount + 1)) { m_AniSpeed = 0.8f / m_oncejumptime; if (m_gs == GridSpace.Space_DOWN) { m_gs = GridSpace.Space_UP; } else { m_gs = GridSpace.Space_DOWN; } GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "1051051", BattleEnvironmentM.Local2WorldPos(lpos[m_JumpCount + 1]), BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); m_JumpCount++; } } } } else if (m_TimeCount < m_action3) { if (m_TimeCount - m_Delatime < m_action2 && m_TimeCount > m_action2) { (m_LifePrent as Role).RoleWalk.Teleport(m_PreTelePortGrid, false); m_LifePrent.m_thisT.localScale = new Vector3(m_LifePrent.m_thisT.localScale.x, Mathf.Abs(m_LifePrent.m_thisT.localScale.y), m_LifePrent.m_thisT.localScale.z); Vector3 effectpos = m_TargetPos; effectpos.y += 0.8f; GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "1051111", BattleEnvironmentM.Local2WorldPos(effectpos), BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(0.75f); gae.AddAction(ndEffect); } } else if (m_TimeCount < m_Duration) { (m_Skin as RoleSkin).SetVisable(true); (m_Skin as RoleSkin).StealthMode(false); m_AniSpeed = 1f; float cout = m_TimeCount - m_action3; float t1 = 0f; float duration = m_MoveTime / 2; Vector3 effectpos = m_TargetPos; effectpos.y += 0.8f; Vector3 pos = m_Start; if (cout >= t1 && (cout - m_Delatime) < t1) { GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "1051121", BattleEnvironmentM.Local2WorldPos(effectpos), BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1f); gae.AddAction(ndEffect); } if (cout < m_MoveTime) { if (cout < duration) { pos = Vector3.Lerp(m_Start, m_TargetPos, (cout) / duration); } else { pos = Vector3.Lerp(m_TargetPos, m_End, (cout - duration) / duration); } } else if (cout >= m_MoveTime) { if (cout - m_Delatime < m_MoveTime) { (m_LifePrent as Role).RoleWalk.Teleport(m_TelePortGrid, false); } pos = m_End; } PlayAction(AnimatorState.Skill01, pos, true); } }
public override void ActiiveStart() { Life w = m_LifePrent.m_Skill.m_SkillTarget; if (w is Role) { //Transform EffectPos = (w as Role).m_Skin.ProPerty.m_EffectPos; GameObject posgo = (w as Role).m_Skin.ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectPos); if (posgo != null) { Vector3 pos = posgo.transform.position; pos.z = -1.5f; //SkillEffects._instance.LoadEffect("effect/prefab/", "1002051",pos,1f); GameObjectActionExcute gae1 = EffectM.LoadEffect(EffectM.sPath, "1002051", pos, BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect1 = new GameObjectActionDelayDestory(1f); gae1.AddAction(ndEffect1); } } SoundPlay.Play("skill_voice_yidao", false, false); SoundPlay.Play("skill_yidao_sstx", false, false); Life emeny = CM.GetAllLifeM(m_AttackSceneID, LifeMType.ALL); GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, "1051041", BattleEnvironmentM.Local2WorldPos(m_TargetPos), BattleEnvironmentM.GetLifeMBornNode(true)); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(m_action3); gae.AddAction(ndEffect); GameObject go = gae.gameObject; go.transform.parent = m_Skin.tRoot; go.transform.localPosition = Vector3.zero; //m_LifePrent.InBoat =false; MapGrid gfrom = m_LifePrent.GetMapGrid(); m_TelePortGrid = gfrom; MapGrid gstart = gfrom; //m_Dir = WalkDir.WALKRIGHT; MapGrid gto = emeny.GetTargetMapGrid(); int startunit = MapSize.GetGridStart(gto.GridPos.Layer); int endtunit = startunit + MapSize.GetLayerSize(gto.GridPos.Layer) - 1; //if (gto.GridPos.Layer > 0) MapGrid start = MapGrid.GetMG(gto.GridPos.Layer, startunit); MapGrid end = MapGrid.GetMG(gto.GridPos.Layer, endtunit); MapGrid gl = gto.GetNextAttackStation(DIR.LEFT, false); MapGrid gr = gto.GetNextAttackStation(DIR.RIGHT, false); if (gl == null && gr == null) { Debug.LogError("xxxxxxxxxxxxxxxxXXXXXXXXXXXXXX " + gto.GridPos); } if (emeny is Role) { m_TargetPos = emeny.m_thisT.localPosition; } else { m_TargetPos = gto.pos; } if (gfrom.GridPos.Unit < startunit) { gstart = start; } else if (gfrom.GridPos.Unit > endtunit) { gstart = end; } if (gto.GridPos.Layer > 0) { int upstartunit = MapSize.GetGridStart(gto.GridPos.Layer - 1); int upendtunit = upstartunit + MapSize.GetLayerSize(gto.GridPos.Layer - 1) - 1; MapGrid upstart = MapGrid.GetMG(gto.GridPos.Layer - 1, upstartunit); MapGrid upend = MapGrid.GetMG(gto.GridPos.Layer - 1, upendtunit); if (gfrom.GridPos.Unit < upstartunit) { gstart = upstart; } else if (gfrom.GridPos.Unit > upendtunit) { gstart = upend; } } m_gs = (m_LifePrent as Role).CurrentGS; if (m_gs == GridSpace.Space_UP) { m_LifePrent.m_thisT.localScale = new Vector3(m_LifePrent.m_thisT.localScale.x, -m_LifePrent.m_thisT.localScale.y, m_LifePrent.m_thisT.localScale.z); } if (gr != null && gstart.GridPos.Unit > gr.GridPos.Unit) { m_Dir = WalkDir.WALKLEFT; m_PreTelePortGrid = gr; if (gl != null) { /*MapGrid temp = gl.GetNextAttackStation(DIR.LEFT,false); * if ( temp!= null) * gl = temp;*/ //w.Teleport(gl); m_TelePortGrid = gl; m_End = gl.pos; //m_Dir = WalkDir.WALKLEFT; } else { m_TelePortGrid = gr; //w.Teleport(gr); m_End = gr.pos; } MapGrid oldgrid = null; if (gstart.GridPos.Unit - gr.GridPos.Unit <= 3) { oldgrid = MapGrid.GetMG(gr.GridPos.Layer, gstart.GridPos.Unit); if (m_gs == GridSpace.Space_DOWN) { lpos.Add(gfrom.pos); Vector3 upos = gr.Uppos; upos.x += (oldgrid.Uppos.x - gr.Uppos.x) / 2; lpos.Add(upos); lpos.Add(gr.pos); } else { lpos.Add(gfrom.Uppos); lpos.Add(gr.pos); } } else { oldgrid = MapGrid.GetMG(gr.GridPos.Layer, gstart.GridPos.Unit); if (m_gs == GridSpace.Space_DOWN) { lpos.Add(gfrom.pos); Vector3 upos = gr.Uppos; upos.x += (oldgrid.Uppos.x - gr.Uppos.x) * 3 / 4; lpos.Add(upos); lpos.Add(gr.pos + new Vector3((oldgrid.pos.x - gr.pos.x) / 2, 0, 0)); lpos.Add(gr.Uppos + new Vector3((oldgrid.Uppos.x - gr.Uppos.x) / 4, 0, 0)); lpos.Add(gr.pos); } else { lpos.Add(gfrom.Uppos); lpos.Add(gr.pos); } } } else if (gl != null && gstart.GridPos.Unit < gl.GridPos.Unit) { m_Dir = WalkDir.WALKRIGHT; m_PreTelePortGrid = gl; if (gr != null) { /*MapGrid temp = gr.GetNextAttackStation(DIR.RIGHT,false); * if ( temp!= null) * gr = temp;*/ //w.Teleport(gr); m_TelePortGrid = gr; m_End = gr.pos; } else { //w.Teleport(gl); m_TelePortGrid = gl; m_End = gl.pos; } MapGrid oldgrid = null; if (gl.GridPos.Unit - gstart.GridPos.Unit <= 3) { oldgrid = MapGrid.GetMG(gl.GridPos.Layer, gstart.GridPos.Unit); if (m_gs == GridSpace.Space_DOWN) { lpos.Add(gfrom.pos); Vector3 upos = gl.Uppos; upos.x += (oldgrid.Uppos.x - gl.Uppos.x) / 2; lpos.Add(upos); lpos.Add(gl.pos); } else { lpos.Add(gfrom.Uppos); lpos.Add(gl.pos); } } else { oldgrid = MapGrid.GetMG(gl.GridPos.Layer, gstart.GridPos.Unit); if (m_gs == GridSpace.Space_DOWN) { lpos.Add(gfrom.pos); Vector3 upos = oldgrid.Uppos; upos.x += (gl.Uppos.x - oldgrid.Uppos.x) / 4; lpos.Add(upos); lpos.Add(oldgrid.pos + new Vector3((gl.pos.x - oldgrid.pos.x) / 2, 0, 0)); lpos.Add(oldgrid.Uppos + new Vector3((gl.Uppos.x - oldgrid.pos.x) * 3 / 4, 0, 0)); lpos.Add(gl.pos); } else { lpos.Add(gfrom.Uppos); lpos.Add(gl.pos); } } } else { if (gl != null && gfrom.GridPos.Unit < gto.GridPos.Unit) { m_Dir = WalkDir.WALKRIGHT; m_Start = gl.pos; m_End = gl.pos; m_PreTelePortGrid = gl; if (gr != null) { lpos.Add(gfrom.pos); Vector3 upos = gl.Uppos; upos.x += (gr.Uppos.x - gl.Uppos.x) / 2; lpos.Add(upos); lpos.Add(gr.pos); lpos.Add(upos); lpos.Add(gl.pos); //w.Teleport(gr); m_TelePortGrid = gr; m_End = gr.pos; } else { m_TelePortGrid = gl; lpos.Add(gfrom.pos); Vector3 upos = gl.Uppos; lpos.Add(upos); lpos.Add(gl.pos); lpos.Add(upos); lpos.Add(gl.pos); } } else if (gr != null && gfrom.GridPos.Unit > gto.GridPos.Unit) { m_PreTelePortGrid = gr; m_Dir = WalkDir.WALKLEFT; m_Start = gr.pos; m_End = gr.pos; if (gl != null) { lpos.Add(gfrom.pos); Vector3 upos = gl.Uppos; upos.x += (gr.Uppos.x - gl.Uppos.x) / 2; lpos.Add(upos); lpos.Add(gl.pos); lpos.Add(upos); lpos.Add(gr.pos); //w.Teleport(gl); m_TelePortGrid = gl; m_End = gl.pos; } else { m_TelePortGrid = gr; lpos.Add(gfrom.pos); Vector3 upos = gr.Uppos; lpos.Add(upos); lpos.Add(gr.pos); lpos.Add(upos); lpos.Add(gr.pos); } } else { m_PreTelePortGrid = gto; m_Start = gto.pos; m_End = gto.pos; //Debug.Log("左右都没有攻击位" + gl.GridPos + "," + gr.GridPos + "," +gfrom.GridPos + "," + gto.GridPos.Unit); } } //PlayAction(AnimatorState.Skill01,m_Start,true); #if UNITY_EDITOR_LOG string str = "lujin:"; for (int i = 0; i < lpos.Count; i++) { str += lpos[i] + ", "; } //Debug.Log(str + ", mend " +m_End); #endif if (lpos.Count > 0) { m_Start = lpos[lpos.Count - 1]; m_oncejumptime = m_JumpTime / (lpos.Count - 1); m_AniSpeed = 0.8f / m_oncejumptime; m_gs = (m_LifePrent as Role).CurrentGS; m_JumpCount = 0; } #if UNITY_EDITOR_LOG FileLog.write(m_LifePrent.SceneID, "能量燃烧 " + m_Start + "," + m_End + "," + m_TelePortGrid.GridPos + "," + m_Dir + "," + gfrom.GridPos + "," + gto.GridPos); #endif }
private static void CalcFlyData(Life deck, Vector3 end, LocationType t, ref List <Vector3> FlyLine, ref Vector3 BornPos) { float height = 4.0f; float width = 2.5f; if (FlyLine == null) { FlyLine = new List <Vector3>(); } FlyLine.Clear(); if (t == LocationType.Top) { if (deck != null) { end = deck.GetMapGrid().pos; } end.x += 1.5f; Vector3 start = end; start.y += height * 3; Vector3 Pos = BattleEnvironmentM.Local2WorldPos(start); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x, end.y + height * 2, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x, end.y + height, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(end); FlyLine.Add(Pos); BornPos = Pos; } else if (t == LocationType.Left) { if (deck != null) { end = deck.GetMapGrid().pos; } end.y += 1.5f; Vector3 start = end; start.x -= width * 3; Vector3 Pos = BattleEnvironmentM.Local2WorldPos(start); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x - width * 2, end.y, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x - width, end.y, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(end); FlyLine.Add(Pos); BornPos = Pos; } else if (t == LocationType.Right) { if (deck != null) { end = deck.GetMapGrid().pos; } end.y += 1.5f; Vector3 start = end; start.x += width * 3; Vector3 Pos = BattleEnvironmentM.Local2WorldPos(start); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x + width, end.y, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(new Vector3(end.x + width, end.y, end.z)); FlyLine.Add(Pos); Pos = BattleEnvironmentM.Local2WorldPos(end); FlyLine.Add(Pos); BornPos = Pos; } }