public FsmNavGraph SetNavGraph(NavGraph go) { FsmNavGraph doo = new FsmNavGraph(); doo.Value = go; return(doo); }
/* * public Int3 v3i3(UnityEngine.Vector3 go,Node doo ){ * float prf = Int3.PrecisionFactor; * return (new Int3((go.x/prf) as int,(go.y/prf) as int,(go.z/prf))); * } * * public List<Pathfinding.Nodes.GridNode> GridNodeToList(Pathfinding.Nodes.GridNode[] go){ * List<Pathfinding.Nodes.GridNode> outo; * * var x = 0; * while (x<go.Length) * { * outo[x] = go[x]; * x++; * } * * return outo; * * } */ /* * public void FsmGetTypeOf(go) { * if(go){ * var doo = (go as FsmPathfindingBase).Value; * return typeof(doo.Value); * } * } * * public void GetAnything(go) { * var typo = FsmGetTypeOf(go); * * if (typo == Node) { //Node * return GetNode(go); * } * * if (typo == Nodes.GridNode) { //GridNode * return GetGridNode(go); * } * return null; * } * * public void GetAnythingShallow(mo) { * var go = mo as FsmObject; * var typo = typeof(go.Value); * * if (typo == FsmNode) { //Node * //Debug.Log(typo); * return GetNode(go) as Node; * } * * else if (typo == FsmGridNode) { //GridNode * //Debug.Log("GridNode"); * return GetGridNode(go) as Nodes.GridNode; * } * * else if (typo == FsmNodes) { //Node[] * //Debug.Log("Nodes"); * return GetNodes(go) as Node[]; * } * * else if (typo == FsmGridNodes) { //GridNode[] * //Debug.Log("GridNodes"); * return GetGridNodes(go) as Nodes.GridNode[]; * } * * else if (typo == FsmPath) { //Path * //Debug.Log("Path"); * return GetPath(go) as Path; * } * * else if (typo == FsmABPath) { //ABPath * //Debug.Log("ABPath"); * return GetPath(go) as ABPath; * } * * else if (typo == FsmPointGraph) { //PointGraph * //Debug.Log("PointGraph"); * return GetPointGraph(go) as PointGraph; * } * * else if (typo == FsmPointGraphs) { //PointGraphs * //Debug.Log("PointGraphs"); * return GetPointGraphs(go) as PointGraph[]; * } * return null; * } * * public void SetAnything(go) { * var typo = FsmGetTypeOf(go); * * if (typo == Node) { //Node * //Debug.Log(typo); * return GetNode(go); * } * * if (typo == Nodes.GridNode) { //GridNode * //Debug.Log("GridNode"); * return GetGridNode(go); * } * * if (typo == List.<Node>) { //Nodes * //Debug.Log(typo); * return GetNodes(go); * } * * if (typo == typeof(Nodes.GridNode[])) { //GridNodes * //Debug.Log("GridNodes"); * return GetGridNodes(go); * } * * if (typo == PointGraph) { //PointGraph * //Debug.Log(typo); * return GetPointGraph(go); * } * * if (typo == typeof(PointGraph[])) { //PointGraphs * //Debug.Log(typo); * return GetPointGraphs(go); * } * return null; * } * * * // AstarPath * public AstarPath GetAstarPath( FsmObject go){ //Turns the action input directly into an AstarPath * var doo = FsmAstarPath(); * doo = go.Value; * AstarPath foo = doo.Value as AstarPath; * return foo; * } * * public FsmAstarPath SetAstarPath(AstarPath go){ //Uses FsmAstarPath as input and returns AstarData * FsmAstarPath doo = FsmAstarPath(); * doo.Value = go; * return doo; * } * * * // AstarData * public AstarData GetAstarData(FsmObject go){ //Uses FsmAstarData as input and returns AstarData * FsmAstarData doo = go.Value; * AstarData foo = doo.Value; * return foo; * } * public FsmAstarData SetAstarData(AstarData go){ //Uses FsmAstarData as input and returns AstarData * FsmAstarData doo = FsmAstarData(); * doo.Value = go; * return doo; * } * * * // NavGraphs * public NavGraph[] GetNavGraphs(FsmObject go){ * FsmNavGraphs doo = go.Value; * NavGraph[] foo = doo.Value; * return foo; * } * public FsmNavGraphs SetNavGraphs(NavGraph[] go){ * FsmNavGraphs doo = FsmNavGraphs(); * doo.Value = go; * return doo; * } */ // NavGraph public NavGraph GetNavGraph(FsmObject go) { FsmNavGraph doo = go.Value as FsmNavGraph; NavGraph foo = doo.Value; return(foo); }
// Use this for initialization public override void OnEnter() { FsmNavGraph go = graph.Value as FsmNavGraph; if (go.Value as PointGraph == null) { Finish(); return; } g = go.Value as PointGraph; DoStuff(); if (!everyFrame.Value) { Finish(); } }
public override void OnEnter() { mo = graph.Value as FsmNavGraph; if ((mo == null) || (mo.Value == null) || alwaysNew.Value) { AstarPath.active.astarData.AddGraph(mo.Value); g = FsmConverter.GetNavGraph(graph) as PointGraph; Debug.Log("Creating New Point Graph"); graph.Value = FsmConverter.SetNavGraph(g as NavGraph); } else { g = FsmConverter.GetNavGraph(graph) as PointGraph; } DoStuff(); Finish(); }
public override void OnEnter() { var go = graphs.Value as FsmNavGraphs; if ((go.Value == null) || !graph.UseVariable) { Finish(); return; } // it would continue for a frame without return var goo = FsmConverter.GetNavGraphs(graphs); var coo = new FsmNavGraph(); if (index.Value >= goo.Length) //check if the index exists { Finish(); } coo.Value = goo[index.Value]; graph.Value = coo; Finish(); }
public void DoStuff() { var doo = ((node as FsmObject).Value as FsmNode).Value as Node; nodeIndex.Value = doo.GetNodeIndex(); penalty.Value = (int)doo.penalty; area.Value = doo.area; tags.Value = doo.tags; walkable.Value = doo.walkable; graphIndex.Value = doo.graphIndex; position.Value = new Vector3(doo.position.x, doo.position.y, doo.position.z); position.Value *= Int3.PrecisionFactor; if (!connectedNodes.IsNone) { (connectedNodes.Value as FsmNodes).Value = (List <Node>)FsmConverter.NodeListToArray(doo.connections); } var loo = new FsmNavGraph(); loo.Value = AstarPath.active.graphs[doo.graphIndex]; graph.Value = loo; }