Example #1
0
    void FrieSoldiers()
    {
        List <int> firingRoleIDs = CmCarbon.GetFireSoldiers(m_timeElapse, 0f);

        for (int i = 0; i < firingRoleIDs.Count; i++)
        {
            int firingID = firingRoleIDs[i];

            if (m_WatingRoleIDs.Contains(firingID))
            {
                m_WatingRoleIDs.Remove(firingID);
                m_CountDownMap.Remove(firingID);
                mBattleIncomingWnd.DestroyEnemySoldier(firingID);
            }

            if (!m_FiringRoleMaps.ContainsKey(firingID))
            {
                SoldierInfo soldier = CmCarbon.GetSoldierInfo(LifeMCamp.ATTACK, firingID);
                m_FiringRoleMaps[firingID] = soldier;

                List <Vector3> FlyLine = new List <Vector3>();
                Vector3        BornPos = Vector3.zero;
                FireAI.GetFlyBorn(m_Soldier.m_FireAI, ref FlyLine, ref BornPos);

                m_FlyPostionMap[firingID] = FlyLine;
                PlayEnemyFlyHitPoint(BornPos);
            }
        }

        List <int> removeList = new List <int>();

        foreach (KeyValuePair <int, SoldierInfo> keyVal in m_FiringRoleMaps)
        {
            int         soldierID = keyVal.Key;
            SoldierInfo soldier   = keyVal.Value;

            List <Vector3> FlyLine = m_FlyPostionMap[soldierID];
            if (FlyLine != null && soldier != null)
            {
                if (SoldierFire.Fire(FlyLine, soldierID, soldier, false) == true)
                {
                    CmCarbon.SetBorn(soldierID);
                    removeList.Add(soldierID);
                }
            }
        }

        for (int i = 0; i < removeList.Count; i++)
        {
            int removeID = removeList[i];
            m_FiringRoleMaps.Remove(removeID);
        }
    }
Example #2
0
    /// <summary>
    /// 手指抬起
    /// </summary>
    /// <param name="gesture"></param>
    public void FingerUp(Vector3 posWorld)
    {
        if (s_bEnableFire == false)
        {
            return;
        }
        if (!PlayerSoldierFire.s_bCollectTouchPoint)
        {
            return;
        }
        PlayerSoldierFire.s_bCollectTouchPoint = false;
        MainCameraM.s_Instance.EnableDrag(true);
        m_v3TouchPostions.Add(posWorld);
        if (!SoldierFire.CheckFlyLine(ref m_v3TouchPostions))
        {
            return;
        }
        float click = 40f;

        click *= click;
        Vector2 v2totalmouseDelta = m_vtotalmouseDelta;

        if (v2totalmouseDelta.sqrMagnitude <= click)
        {
            return;
        }
        //兵已全部发射出去
        if (CmCarbon.IsAllFireOut())
        {
            return;
        }
        SoldierInfo soldierInfo = CmCarbon.GetSoldierInfo(LifeMCamp.ATTACK, soldierDataID);

        if (SoldierFire.Fire(m_v3TouchPostions, soldierDataID, soldierInfo, true) == true)
        {
            CmCarbon.SetBorn(soldierDataID);
            CombatWnd Wnd = WndManager.FindDialog <CombatWnd>();
            if (Wnd != null)
            {
                Wnd.FireLater(soldierDataID);
                Wnd.ResetUIScale();
                //Wnd.AutoSelectNextSoldier();
            }
        }
        if (CmCarbon.IsAllFireOut())
        {
            MainCameraM.s_Instance.AutoMoveTo(MainCameraM.s_vBattleBoatviewCamPos);
        }
    }