/// <summary>
 /// 处理地图方块的鼠标进入
 /// </summary>
 /// <param name="mapBlock"></param>
 /// <param name="eventData"></param>
 virtual public void OnPointerEnter(BattleMapBlock mapBlock, PointerEventData eventData)
 {
     Debug.Log(mapBlock.GetSelfPosition());
     if (BattleMap.BattleMap.Instance().IsColor == true)
     {
         BattleMap.BattleMap.Instance().ShowBattleZooe(mapBlock.GetSelfPosition());
     }
 }
        public override void OnPointerDownBlock(BattleMapBlock mapBlock, PointerEventData eventData)
        {
            base.OnPointerDownBlock(mapBlock, eventData);

            //获取第一个选择的对象
            GameUnit.GameUnit unit = BattleMap.BattleMap.Instance().GetUnitsOnMapBlock(FSM.TargetList[0]);
            //创建移动指令
            Vector2         startPos = FSM.TargetList[0];
            Vector2         endPos   = mapBlock.position;
            UnitMoveCommand unitMove = new UnitMoveCommand(unit, startPos, endPos, mapBlock.GetSelfPosition());

            //如果移动指令合法
            if (unitMove.Judge())
            {
                //移动完毕关闭移动范围染色
                Vector2 pos = BattleMap.BattleMap.Instance().GetUnitCoordinate(unit);
                FSM.HandleMovCancel(pos);
                GameUtility.UtilityHelper.Log("移动完成,进入攻击状态,点击敌人进行攻击,右键点击角色取消攻击", GameUtility.LogColor.RED);
                unitMove.Excute();

                //清空对象列表
                //FSM.TargetList.Clear();
                FSM.TargetList.Add(endPos);
                //unit.restrain = true;

                FSM.PushState(new InputFSMAttackState(FSM));//状态机压入新的攻击状态
            }
            else
            {
                //如果不符合移动条件,什么都不做
            }
        }
 /// <summary>
 /// 处理地图方块的鼠标移出
 /// </summary>
 /// <param name="mapBlock"></param>
 /// <param name="eventData"></param>
 virtual public void OnPointerExit(BattleMapBlock mapBlock, PointerEventData eventData)
 {
     if (BattleMap.BattleMap.Instance().IsColor == true)
     {
         BattleMap.BattleMap.Instance().HideBattleZooe(mapBlock.GetSelfPosition());
     }
 }
Beispiel #4
0
 /// <summary>
 /// 处理地图方块的鼠标进入
 /// </summary>
 /// <param name="mapBlock"></param>
 /// <param name="eventData"></param>
 public void OnPointerEnter(BattleMapBlock mapBlock, PointerEventData eventData)
 {
     if (BattleMap.BattleMap.Instance().IsColor == true)
     {
         BattleMap.BattleMap.Instance().ShowBattleZooe(mapBlock.GetSelfPosition());
     }
     //TODO显示技能伤害的范围
 }
Beispiel #5
0
        public override void OnPointerDownBlock(BattleMapBlock mapBlock, PointerEventData eventData)
        {
            base.OnPointerDownBlock(mapBlock, eventData);

            //在对应MapBlock生成单位
            UnitManager.InstantiationUnit(FSM.selectedCard.id, OwnerEnum.Player, mapBlock);
            //把这张手牌从手牌里删掉
            CardManager.Instance().RemoveCardToMapList(FSM.selectedCard.gameObject);
            // 扣除消耗的Ap值
            Player.Instance().ConsumeAp(FSM.selectedCard.GetComponent <BaseCard>().cost);
            //删掉对应手牌槽的引用
            FSM.selectedCard = null;
            //关闭鼠标所在战区的高光显示
            BattleMap.BattleMap.Instance().IsColor = false;
            BattleMap.BattleMap.Instance().HideBattleZooe(mapBlock.GetSelfPosition());
            //创建部署指令并执行
            BattleDispositionCommand unitDispose = new BattleDispositionCommand(mapBlock.units_on_me);

            unitDispose.Excute();
            //状态机压入静止状态
            this.FSM.PushState(new InputFSMIdleState(FSM));
        }