public DGPlayNode(PlayAnimationNode pan, StateNode state) : base(pan, state, true) { if (pan == null) { throw new ArgumentNullException("pan"); } this.mPlayNode = pan; this.mSlotSetup = new SlotBuilder(this.mScene, pan.SlotSetup); this.UpdateVisualization(); }
private DGNode InitDGN(DGNode src, DecisionGraphNode dgn) { int i; DGNode dst = null; for (i = this.mDGraph.NodeCount - 1; i >= 0; i--) { dst = this.mDGraph.NodeAt(i); if (dst.DGN == dgn) { break; } } if (i < 0) { int j; DGEdge edge; AnchorPoint ap; DecisionGraphNode[] dgns; DGMulticastNode dgmcn = null; switch (dgn.ChunkType) { case NextStateNode.ResourceType: NextStateNode nsn = dgn as NextStateNode; dst = new DGSnSnNode(nsn, this); this.mDGraph.AddNode(dst); dst.SetParent(this); break; case RandomNode.ResourceType: RandomNode rand = dgn as RandomNode; DGRandNode dgrn = new DGRandNode(rand, this); this.mDGraph.AddNode(dgrn); dgrn.SetParent(this); List <RandomNode.Slice> slices = rand.Slices; if (slices.Count > 0) { for (i = 0; i < slices.Count; i++) { ap = dgrn.GetSliceAnchor(i); dgns = slices[i].Targets.ToArray(); for (j = 0; j < dgns.Length; j++) { dst = this.InitDGN(dgrn, dgns[j]); edge = new DGEdge(dgrn, dst, false); ap.Edges.Add(edge); dst.EntryAnchor.Edges.Add(edge); this.mDGraph.AddEdge(edge); edge.SetParent(this); } } } dst = dgrn; break; case SelectOnDestinationNode.ResourceType: SelectOnDestinationNode sodn = dgn as SelectOnDestinationNode; DGSoDnNode dgsodn = new DGSoDnNode(sodn, this); this.mDGraph.AddNode(dgsodn); dgsodn.SetParent(this); if (sodn.CaseCount > 0) { SelectOnDestinationNode.Case[] cases = sodn.Cases; for (i = 0; i < cases.Length; i++) { ap = dgsodn.GetCaseAnchorAt(i); dgns = cases[i].Targets; for (j = 0; j < dgns.Length; j++) { dst = this.InitDGN(dgsodn, dgns[j]); edge = new DGEdge(dgsodn, dst, false); ap.Edges.Add(edge); dst.EntryAnchor.Edges.Add(edge); this.mDGraph.AddEdge(edge); edge.SetParent(this); } } } dst = dgsodn; break; case SelectOnParameterNode.ResourceType: SelectOnParameterNode sopn = dgn as SelectOnParameterNode; DGSoPnNode dgsopn = new DGSoPnNode(sopn, this); this.mDGraph.AddNode(dgsopn); dgsopn.SetParent(this); if (sopn.CaseCount > 0) { SelectOnParameterNode.Case[] cases = sopn.Cases; for (i = 0; i < cases.Length; i++) { ap = dgsopn.GetCaseAnchorAt(i); dgns = cases[i].Targets; for (j = 0; j < dgns.Length; j++) { dst = this.InitDGN(dgsopn, dgns[j]); edge = new DGEdge(dgsopn, dst, false); ap.Edges.Add(edge); dst.EntryAnchor.Edges.Add(edge); this.mDGraph.AddEdge(edge); edge.SetParent(this); } } } dst = dgsopn; break; case CreatePropNode.ResourceType: CreatePropNode cpn = dgn as CreatePropNode; DGPropNode dgcpn = new DGPropNode(cpn, this); this.mDGraph.AddNode(dgcpn); dgcpn.SetParent(this); dgmcn = dgcpn; break; case ActorOperationNode.ResourceType: ActorOperationNode aon = dgn as ActorOperationNode; DGAcOpNode dgaon = new DGAcOpNode(aon, this); this.mDGraph.AddNode(dgaon); dgaon.SetParent(this); dgmcn = dgaon; break; case StopAnimationNode.ResourceType: StopAnimationNode san = dgn as StopAnimationNode; DGStopNode dgsan = new DGStopNode(san, this); this.mDGraph.AddNode(dgsan); dgsan.SetParent(this); dgmcn = dgsan; break; case PlayAnimationNode.ResourceType: PlayAnimationNode pan = dgn as PlayAnimationNode; DGPlayNode dgpan = new DGPlayNode(pan, this); this.mDGraph.AddNode(dgpan); dgpan.SetParent(this); dgmcn = dgpan; break; } if (dgmcn != null) { MulticastDecisionGraphNode mcn = dgn as MulticastDecisionGraphNode; if (mcn.TargetCount > 0) { ap = dgmcn.TargetAnchor; dgns = mcn.Targets; for (i = 0; i < dgns.Length; i++) { dst = this.InitDGN(dgmcn, dgns[i]); edge = new DGEdge(dgmcn, dst, false); ap.Edges.Add(edge); dst.EntryAnchor.Edges.Add(edge); this.mDGraph.AddEdge(edge); edge.SetParent(this); } } dst = dgmcn; } } return(dst); }