123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- public class AStarNode : IPathNode<object>
- {
- public enum Type
- {
- Empty = 0,
- Wall = 1,
- BlueWall = 2,
- RedWall = 3,
- YellowWall = 4
- }
- public static Type[] TypeArr = new Type[]{Type.Empty, Type.Wall, Type.BlueWall, Type.RedWall, Type.YellowWall};
- public Int32 X { get; set; }
- public Int32 Y { get; set; }
- public Type type {get; set;}
- public bool IsWalkable(object obj)
- {
- if(type == Type.Wall)
- return false;
- if(type == Type.Empty)
- return true;
- Craft craft = obj as Craft;
- if(craft != null)
- {
- if(craft.team == TeamUtil.Team.Blue && type == Type.BlueWall)
- {
- return true;
- }
- else if(craft.team == TeamUtil.Team.Red && type == Type.RedWall)
- {
- return true;
- }
- }
- return false;
- }
- }
|