asmrobot
2019-10-16 5597c0b354f881994a75878731c3a02183e9c970
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using RichCreator.Utility;
using RichCreator.Utility.Structs;
using RichCreator.StateMachines;
using RichCreator.Utilitys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace RichCreator.Maps.Lindong
{
    /// <summary>
    /// 禁区类
    /// </summary>
    public class OutOfBounds
    {
        public OutOfBounds(ZTRectangle gameRect,MoveState moveState)
        {
            this.moveState = moveState;
            this.gameRect = gameRect;
            bounds = new ZTRectangle[] {
                new ZTRectangle (1089+gameRect.Start.X,0+gameRect.Start.Y,1280+gameRect.End.X,394+gameRect.End.Y)
 
            };
        }
        /// <summary>
        /// 五号房间的右上角区域
        /// </summary>
        public const Int32 AREA_5Bound = 0;
 
        /// <summary>
        /// 14号房间那个不动的怪
        /// </summary>
        public const Int32 AREA_14Bound = 1;
 
 
        private ZTRectangle gameRect;
 
        private MoveState moveState;
 
        private ZTRectangle[] bounds = null;
 
        /// <summary>
        /// 判断是否在禁区内
        /// </summary>
        /// <param name="houseIndex"></param>
        /// <param name="rolePosition"></param>
        /// <param name="areaID"></param>
        /// <returns></returns>
        public bool InOutOfBound(Int32 houseIndex, ZTPoint rolePosition,out int areaID)
        {
            areaID = 0;
            switch (houseIndex)
            {
                case 5:
                    if (Utilitys.Utils.IsInRect(rolePosition, bounds[AREA_5Bound]))
                    {
                        areaID = AREA_5Bound;
                        return true;
                    }
                    return false;
                case 14:
                    areaID = AREA_14Bound;
                    break;
            }
            return false;
        }
 
        /// <summary>
        /// 移动到正常区域
        /// </summary>
        /// <param name="areaID"></param>
        /// <returns></returns>
        public void MoveToCommonBound(Int32 areaID)
        {
            switch (areaID)
            {
                case AREA_5Bound:
                    this.moveState.SyncMove(new ZTPoint(-600, 0));
                    break;
            }
        }
 
    }
}