Esempio n. 1
0
    /// <summary>
    /// 移動発生のクリックか
    /// </summary>
    void CheckMove()
    {
        Vector2I Pos = GetMouseEnablePos();

        if (Pos != null)
        {
            GoalPos = Pos.Clone();
            Vector2I GoalPos2 = Pos.Clone();

            EventPart findEvent = EventList.Find(i => i.Pos == GoalPos);

            if (findEvent != null)
            {
                if (findEvent.IsClickEvent())
                {
                    GoalPos2 = findEvent.SubPos.Clone();
                }
            }

            // ルート検索
            List <Vector2I> _PathList;

            bool result = A_Star.SearchPath(Grids, NowPos, GoalPos2, out _PathList);

            if (result == false)
            {
                return;
            }

            if (_PathList.Count <= 0)
            {
                return;
            }

            PathList = _PathList;

            if (result)// ルートあり、移動する
            {
                NextPos = PathList[0];
                PathList.RemoveAt(0);

                // 移動指示
                Player.ReqAutoMoving(NextPos.X, NextPos.Y, new ReportEndHandler(OnMoveEnd));

                NowMoveing = true;
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 移動完了イベント
    /// </summary>
    void OnMoveEnd()
    {
        NowPos = NextPos;

        // 到着か
        if (NowPos == GoalPos)
        {
            NowMoveing = false;

            EventPart findEvent = EventList.Find(i => i.Pos == NowPos);

            if (findEvent != null)
            {
                if (findEvent.IsFootEvent())
                {
                    FootEvent(findEvent);
                }
            }
            return;
        }

        // ClickEventのSubPosに到着か
        if (PathList.Count <= 0)
        {
            NowMoveing = false;

            EventPart findEvent = EventList.Find(i => (i.Pos == GoalPos) && (i.SubPos == NowPos));

            if (findEvent != null)
            {
                if (findEvent.IsClickEvent())
                {
                    ClickEvent(findEvent);
                }
            }
            return;
        }

        NextPos = PathList[0];
        PathList.RemoveAt(0);

        // 移動指示
        Player.ReqAutoMoving(NextPos.X, NextPos.Y, new ReportEndHandler(OnMoveEnd));

        NowMoveing = true;
    }
Esempio n. 3
0
    /// <summary>
    /// Event発生のクリックか
    /// </summary>
    bool CheckEvent()
    {
        Vector2I Pos = GetMouseEnablePos();

        if (Pos != null)
        {
            // 現在位置をクリック
            EventPart findEvent = null;

            findEvent = EventList.Find(i => (i.Pos == Pos) && (i.SubPos == NowPos));

            if (findEvent != null)
            {
                if (findEvent.IsClickEvent())
                {
                    // ClickEventをクリック
                    ClickEvent(findEvent);
                    return(true);
                }
            }
            return(false);
        }
        return(false);
    }