// Use this for initialization void Start() { m_FightState = FIGHTSTATE.Stop; LoadFormation(1, 0); //加载进攻阵型 LoadFormation(1, 1); //加载防守阵型 List <int> shipidList = TestShips(); //Debug.Log ("shipidList.Count = " + shipidList.Count); InitShips(shipidList); }
public static void joinFight(Transform Enemy) { Transform[] PlayerArr = Player.GetComponent <PlayerLocation>().PlayerArr; if (fightState == FIGHTSTATE.NONE) { for (int i = 0; i < PlayerArr.Length; i++) { FightParticipants.Add(PlayerArr[i]); } fightState = FIGHTSTATE.FIGHTPREP; } if (fightState == FIGHTSTATE.FIGHTPREP) { if (!FightParticipants.Contains(Enemy)) { FightParticipants.Add(Enemy); } } }
void NextRound() { if (m_FightState == FIGHTSTATE.Stop) { //Debug.Log("Begin Fire"); if (m_CurShipIndex >= GlobalVar.m_maxTeamShips) { //Debug.Log("m_CurShipIndex > GlobalVar.m_maxTeamShips"); m_targetPos = m_shipList[m_CurShipIndex - GlobalVar.m_maxTeamShips].transform.localPosition; m_TargetShipIndex = m_CurShipIndex - GlobalVar.m_maxTeamShips; } else { //Debug.Log("else m_CurShipIndex > GlobalVar.m_maxTeamShips m_shipList.Count = " + m_shipList.Count); m_targetPos = m_shipList[m_CurShipIndex + GlobalVar.m_maxTeamShips].transform.localPosition; m_TargetShipIndex = m_CurShipIndex + GlobalVar.m_maxTeamShips; } m_Sheel.GetComponent <Shell>().Reset(); m_Sheel.GetComponent <Shell>().SetShellTrack(m_targetPos, m_shipList[m_CurShipIndex].transform.localPosition); m_Sheel.GetComponent <Shell>().SetShellType(m_shipList[m_CurShipIndex].GetComponent <ShipFight>().GetShellType()); m_FightState = FIGHTSTATE.Boom; } }
void DoFireProgress() { if (m_FightState == FIGHTSTATE.Boom) { //Debug.Log("m_FightState == FIGHTSTATE.Boom"); if (m_BoomEffect.activeSelf != true) { m_BoomEffect.SetActive(true); m_BoomEffect.transform.localPosition = m_targetPos; m_BoomEffect.GetComponent <PlayAtalsAni>().ResetAni(); } if (m_Sheel.activeSelf) { m_Sheel.SetActive(false); } if (m_HitEffect.activeSelf) { m_HitEffect.SetActive(false); } //Debug.Log("m_BoomEffect.GetComponent<PlayAtalsAni>().m_bIsFnish = " + m_BoomEffect.GetComponent<PlayAtalsAni>().m_bIsFnish); if (m_BoomEffect.GetComponent <PlayAtalsAni>().m_bIsFnish) { m_FightState = FIGHTSTATE.Fly; } } if (m_FightState == FIGHTSTATE.Fly) { //Debug.Log("m_FightState == FIGHTSTATE.Fly"); if (m_BoomEffect.activeSelf) { m_BoomEffect.SetActive(false); } if (!m_Sheel.activeSelf) { m_Sheel.SetActive(true); //m_Sheel.GetComponent<Shell>().SetCubicPos(0.0f); m_Sheel.GetComponent <Shell>().Reset(); } if (m_HitEffect.activeSelf) { m_HitEffect.SetActive(false); } m_Sheel.transform.localPosition = m_Sheel.GetComponent <Shell>().AddCubicPos(FireSpeed); //Debug.Log("m_Sheel.GetComponent<Shell>().GetCubicPos() = " + m_Sheel.GetComponent<Shell>().GetCubicPos()); if (m_Sheel.GetComponent <Shell>().GetCubicPos() >= 1.0f) { m_FightState = FIGHTSTATE.Hit; } } if (m_FightState == FIGHTSTATE.Hit) { //Debug.Log("m_FightState == FIGHTSTATE.Hit"); if (m_BoomEffect.activeSelf) { m_BoomEffect.SetActive(false); } if (m_Sheel.activeSelf) { m_Sheel.SetActive(false); } if (!m_HitEffect.activeSelf) { m_HitEffect.SetActive(true); m_HitEffect.transform.localPosition = m_shipList[m_CurShipIndex].transform.localPosition; m_HitEffect.GetComponent <PlayAtalsAni>().ResetAni(); } if (m_HitEffect.GetComponent <PlayAtalsAni>().m_bIsFnish) { CalculteDamage();//完成收击动画后计算伤害 m_CurShipIndex++; m_FightState = FIGHTSTATE.Stop; if (m_CurShipIndex >= m_shipList.Count) { m_CurShipIndex = 0; } } } else { return; } }