00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "aiNode.h"
00016
00017 AINode::AINode(int grid_x, int grid_y, LVecBase3f pos, float w, float l, float h) {
00018 for (int i = 0; i < 8; ++i) {
00019 _neighbours[i] = NULL;
00020 }
00021
00022 _position = pos;
00023 _width = w;
00024 _length = l;
00025 _height = h;
00026 _grid_x = grid_x;
00027 _grid_y = grid_y;
00028 _status = ST_neutral;
00029 _type = true;
00030 _score = 0;
00031 _cost = 0;
00032 _heuristic = 0;
00033 _next = NULL;
00034 _prv_node = NULL;
00035 }
00036
00037 AINode::~AINode() {
00038 }
00039
00040
00041
00042
00043
00044
00045 bool AINode::contains(float x, float y) {
00046 if (_position.get_x() - _width / 2 <= x && _position.get_x() + _width / 2 >= x &&
00047 _position.get_y() - _length / 2 <= y && _position.get_y() + _length / 2 >= y) {
00048 return true;
00049 }
00050 else {
00051 return false;
00052 }
00053 }