小妖精的完美遊戲教室——人工智能,A*算法,結點篇
//================================================================
//
// Copyright (C) 2017 Team Saluka
// All Rights Reserved
//
// Author小妖精Balous
//
//================================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Saruka
{
/// <summary>
/// 導航網格結點
/// </summary>
public class NavNode
{
public NavNode parent;
/// <summary>
/// 結點世界坐標
/// </summary>
public Vector3 worldPosition;
/// <summary>
/// 能否通行
/// </summary>
public bool isWalkable;
/// <summary>
/// 結點在導航網格中的X坐標
/// </summary>
public int gridX
{
private set;
get;
}
/// <summary>
/// 結點在導航網格中的Y坐標
/// </summary>
public int gridY
{
private set;
get;
}
public float gCost;
public float hCost;
public float fCost
{
get { return gCost + hCost; }
}
/// <summary>
/// 導航網格結點
/// </summary>
/// <param name="_worldPosition">結點世界坐標</param>
/// <param name="_isisWalkable">能否通行</param>
/// <param name="_gridX">結點在導航網格中的X坐標</param>
/// <param name="_gridY">結點在導航網格中的Y坐標</param>
public NavNode(Vector3 _worldPosition, bool _isisWalkable, int _gridX, int _gridY)
{
worldPosition = _worldPosition;
isWalkable = _isisWalkable;
gridX = _gridX;
gridY = _gridY;
}
}
}
小妖精的完美遊戲教室——人工智能,A*算法,結點篇