Exemplo n.º 1
0
    /// <summary>
    /// 触摸操作开始,改变相机模式
    /// </summary>
    /// <param name="gesture"></param>
    //void EasyTouch_On_TouchStart( Gesture gesture ) {
    //    if( CameraStatusType_ == CameraStatusType.Deploy ) return;
    //    if( CameraStatusType_ == CameraStatusType.Lock ) return;
    //    if( gesture.pickedObject == null ) {
    //        if( CameraStatusType_ == CameraStatusType.Free ) return;
    //        SetCameraType( CameraStatusType.Free );
    //    }
    //}

    /// <summary>
    /// 点击
    /// </summary>
    /// <param name="gesture"></param>
    void EasyTouch_On_SimpleTap(Gesture gesture)
    {
        if (CameraStatusType_ < CameraStatusType.Normal)
        {
            return;
        }
        if (CameraStatusType_ == CameraStatusType.Deploy)
        {
            return;
        }
        if (CameraStatusType_ == CameraStatusType.AutoMoveInDeploy)
        {
            return;
        }
        if (CameraStatusType_ == CameraStatusType.DeployMoveToBase)
        {
            return;
        }
        if (CameraStatusType_ == CameraStatusType.DeployMoveToDeploy)
        {
            return;
        }
        if (CameraStatusType_ == CameraStatusType.SkillSelect)
        {
            BattleSceneDisplayManager.SelectSkillTarget(gesture, MainCamera_.transform.position.y);
            return;
        }
        ClickGameObjectInBattle(gesture.pickedObject);
    }
Exemplo n.º 2
0
    public void FoldSkillPanel()
    {
        TeamDisplay display = BattleSceneDisplayManager.GetCommanderShipTeam();

        if (display == null)
        {
            return;
        }
        PanelAnim_.SetTrigger("skill_panel_hide");
        BattleSceneDisplayManager.ResetSkill();
    }
Exemplo n.º 3
0
 private void OnClickCancel()
 {
     PanelAnim_.SetTrigger("skill_panel_hide");
     BattleSceneDisplayManager.CastSkillComplete();
     BattleSceneDisplayManager.CheckCommanderAttackRange();
     for (int i = 0; i < SkillList_.Count; i++)
     {
         //如果处于冷却状态,不应该被打断
         if (!SkillList_[i].IsCooling)
         {
             SkillList_[i].EnableSkill(true);
         }
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// 释放当前选中的技能, by lxl
    /// </summary>
    private void FireSkill(int currentClickIndex)
    {
        // 旗舰
        ClientShip commandShip = BattleSys.GetCommanderShip();

        if (commandShip == null)
        {
            return;
        }
        bool isSelectedSkillTarget = BattleSceneDisplayManager.IsSelectedSkillTarget;

        // 玩家还没选择目标,给提示
        if (!isSelectedSkillTarget)
        {
            // 提示玩家选择目标
            ShowSelecteTargetNotice();
            return;
        }
        // 得到选中的技能
        ClientSkill skill   = BattleSceneDisplayManager.SelectedSkill;
        Vector3     pos     = Vector3.zero;
        int         fightID = -1;

        // 如果是玩家选择的技能
        if (skill.Prop.skill_select_type == Def.SkillSelectType.PlayerSelect)
        {
            // 得到玩家选择的位置或目标
            if (skill.Prop.shape_type == Def.ShapeType.Default)
            {
                TeamDisplay display = (TeamDisplay)BattleSceneDisplayManager.Instance.SkillSelectParam;
                fightID = display.GetShip().InFightID;
            }
            else if (skill.Prop.shape_type == Def.ShapeType.Circle)
            {
                pos = (Vector3)BattleSceneDisplayManager.Instance.SkillSelectParam;
            }
        }
        // 使用技能
        FightService.Instance.UseCommanderSkill(commandShip.InFightID, skill.ID, fightID, pos);

        // 技能释放完毕后要重设选择状态
        BattleSceneDisplayManager.CastSkillComplete();
        BattleSceneDisplayManager.CheckCommanderAttackRange();
    }
Exemplo n.º 5
0
    /// <summary>
    /// 点击技能面板旗舰按钮
    /// </summary>
    void SetClickSkillCtrl()
    {
        // 镜头锁定到旗舰
        GameObject commanderShipObj = BattleSceneDisplayManager.GetCommanderShipObj();

        if (commanderShipObj == null)
        {
            return;
        }
        for (int i = 0; i < SkillList_.Count; i++)
        {
            //如果处于冷却状态,不应该被打断
            if (!SkillList_[i].IsCooling)
            {
                SkillList_[i].EnableSkill(true);
            }
        }
        CameraManager.ClickGameObjectInBattle(commanderShipObj);
    }
Exemplo n.º 6
0
    /// <summary>
    /// 选中对应index的技能, by lxl
    /// </summary>
    /// <param name="index"></param>
    void SetSelectSkill(int index)
    {
        if (index != BattleSceneDisplayManager.SelectedSkillIndex)
        {
            for (int i = 0; i < SkillList_.Count; i++)
            {
                if (i != index)
                {
                    //如果处于冷却状态,不应该被打断
                    if (!SkillList_[i].IsCooling)
                    {
                        SkillList_[i].EnableSkill(true);
                    }
                }
            }
        }

        // 一般技能不需要选择目标
        BattleSceneDisplayManager.IsSelectedSkillTarget = true;
        // 缓存技能index
        BattleSceneDisplayManager.SelectedSkillIndex = index;
        // 缓存选中技能
        BattleSceneDisplayManager.SelectedSkill = CommandShip_.GetSkillByIndex(index);
        ClientSkill skill = BattleSceneDisplayManager.SelectedSkill;

        // 如果是需要玩家选择目标的技能
        if (skill.Prop.skill_select_type == Def.SkillSelectType.PlayerSelect)
        {
            // 需要选择目标
            BattleSceneDisplayManager.IsSelectedSkillTarget = false;
            // 提示玩家选择目标
            ShowSelecteTargetNotice();
        }
        // 相机设置为技能选择模式
        CameraManager.Instance.SetCameraType(CameraManager.CameraStatusType.SkillSelect);
        // 开始显示技能范围和目标选择
        BattleSceneDisplayManager.ShowCommanderShipSkillRange();
    }
Exemplo n.º 7
0
    public void ModifyHp(proto.UnderAttackInfo underAttackInfo)
    {
        // 得到优先目标
        int index = 0;

        if (HurtShipIndexList.Count > 0)
        {
            index = HurtShipIndexList[HurtShipIndexList.Count - 1];
            HurtShipIndexList.RemoveAt(HurtShipIndexList.Count - 1);
        }

        // 处理伤害值
        ClientShip_.Durability += underAttackInfo.durablility;
        ClientShip_.Armor      += underAttackInfo.armor;
        ClientShip_.Energy     += underAttackInfo.energy;

        // 同步血条
        BattleShipInfo_.UpdateUIByUnderAttack(ClientShip_.Durability, ClientShip_.Energy, ClientShip_.Armor);

        // 单个船的直接算
        if (ShipList_.Count == 1)
        {
            // 若为0,销毁
            if (ClientShip_.Durability <= 0)
            {
                IsDead = true;
                ShipList_[index].StartCoroutine(ShipList_[index].ShowDead());
                // 我方旗舰
                if (IsPlayerShip() && IsCommanderShip())
                {
                    BattleSceneDisplayManager.PlayerCommanderShipDead();
                }
                // 敌方基地
                if (!IsPlayerShip() && GetShipStrait() == Def.ShipTrait.Build)
                {
                    BattleSceneDisplayManager.EnemyCommanderShipDead(RootGo_);
                }
                Destroy();
            }
            return;
        }

        // 多个船的 根据当前血量算出需要爆炸几个船
        int maxDurability = ClientShip_.MaxDurability * ShipList_.Count;
        int maxDeadNum    = (int)(ShipList_.Count * (1f - (float)ClientShip_.Durability / (float)maxDurability));
        int haveDeadNum   = 0;

        int deadNum = 0;

        for (int i = 0; i < ShipList_.Count; i++)
        {
            if (ShipList_[i] == null)
            {
                deadNum++;
            }
            else
            {
                if (ShipList_[i].IsDead)
                {
                    deadNum++;
                }
            }
        }

        for (int i = 0; i < ShipList_.Count; i++)
        {
            if (ShipList_[i] != null)
            {
                if (ShipList_[i].IsDead)
                {
                    haveDeadNum++;
                }
            }
            else
            {
                haveDeadNum++;
            }
        }

        int needDeadNum = maxDeadNum - haveDeadNum;

        needDeadNum = needDeadNum < 0 ? 0 : needDeadNum;

        if (needDeadNum > 0 && ShipList_[index] != null)
        {
            if (!ShipList_[index].IsDead)
            {
                ShipList_[index].StartCoroutine(ShipList_[index].ShowDead());
                needDeadNum--;
            }
        }
        for (int i = 0; i < ShipList_.Count; i++)
        {
            if (needDeadNum <= 0)
            {
                break;
            }
            if (ShipList_[i] == null)
            {
                continue;
            }
            if (ShipList_[i].IsDead)
            {
                continue;
            }
            ShipList_[i].StartCoroutine(ShipList_[i].ShowDead());
            needDeadNum--;
        }

        if (ClientShip_.Durability <= 0)
        {
            IsDead = true;
            Destroy();
        }
    }