1
|
|
|
/* |
2
|
|
|
* This file is part of ArakneUtils. |
3
|
|
|
* |
4
|
|
|
* ArakneUtils is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* ArakneUtils is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with ArakneUtils. If not, see <https://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* Copyright (c) 2017-2020 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.arakne.utils.maps.constant; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Available movement values for a cell. |
24
|
|
|
* Contains information about the walkable state and path priority. |
25
|
|
|
*/ |
26
|
|
|
public enum CellMovement { |
27
|
|
|
/** |
28
|
|
|
* Simple not walkable cell |
29
|
|
|
*/ |
30
|
|
|
NOT_WALKABLE, |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Not walkable cell containing an interactive object |
34
|
|
|
*/ |
35
|
|
|
NOT_WALKABLE_INTERACTIVE, |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Movement for triggers. |
39
|
|
|
* Note: some triggers has the "default" movement. This value is not reliable for detect triggers. |
40
|
|
|
*/ |
41
|
|
|
TRIGGER, |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Walkable cells, but not prioritized. |
45
|
|
|
* Also contains cellar access cells. |
46
|
|
|
*/ |
47
|
|
|
LESS_WALKABLE, |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Default movement value for walkable cells |
51
|
|
|
*/ |
52
|
|
|
DEFAULT, |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Cells for paddocks |
56
|
|
|
*/ |
57
|
|
|
PADDOCK, |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Cells for a road. Those cells are prioritized. |
61
|
|
|
*/ |
62
|
|
|
ROAD, |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* The higher movement value, the most prioritized walkable cells. |
66
|
|
|
*/ |
67
|
|
|
MOST_WALKABLE; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Cache the movement values |
71
|
|
|
*/ |
72
|
|
|
final static private CellMovement[] values = values(); |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Check if the current movement is for a walkable cell |
76
|
|
|
*/ |
77
|
|
|
public boolean walkable() { |
78
|
|
|
return ordinal() > 1; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get a cell movement by its integer value |
83
|
|
|
*/ |
84
|
|
|
static public CellMovement byValue(int value) { |
85
|
|
|
return values[value]; |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|