小妖精的完美游戏教室——人工智能,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*算法,导航网络篇


下一篇:vsftpd本地用户登录密码错误