root/src/AIRendering/DrawableCyclicRoute.cs
| 1 | 23 | ||
|---|---|---|---|
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Text; | 4 | using System.Text; |
5 | using Brains.Framework.Behaviors.PathFinding; | 5 | using Brains.Framework.Behaviors.PathFinding; |
6 | using Brains.Framework.Behaviors; | ||
6 | 7 | ||
7 | namespace AIRendering | 8 | namespace AIRendering |
8 | { | 9 | { |
... | ... | ||
11 | 12 | ||
12 | public void Render(PrimitiveBatch batch) | 13 | public void Render(PrimitiveBatch batch) |
13 | { | 14 | { |
14 | if (SubBehaviors[CurrentSubBehavior] is IRender) | 15 | if (CurrentSubBehavior > 0) |
15 | { | 16 | { |
16 | ((IRender)SubBehaviors[CurrentSubBehavior]).Render(batch); | 17 | if (SubBehaviors[CurrentSubBehavior] is IRender) |
17 | } | ||
18 | for (int i = 0; i < SubBehaviors[CurrentSubBehavior].SubBehaviors.Count; i++) | ||
19 | { | ||
20 | if (SubBehaviors[CurrentSubBehavior].SubBehaviors[i] is FollowPathBehavior) | ||
21 | { | 18 | { |
22 | DrawableBehaviorGoTo.DrawFollowPath(SubBehaviors[CurrentSubBehavior].SubBehaviors[i] as FollowPathBehavior, | 19 | ((IRender)SubBehaviors[CurrentSubBehavior]).Render(batch); |
23 | batch); | ||
24 | } | 20 | } |
25 | 21 | ||
22 | ISubBehaviorHolder subs = (ISubBehaviorHolder)SubBehaviors[CurrentSubBehavior]; | ||
23 | if (subs != null) | ||
24 | { | ||
25 | for (int i = 0; i < subs.SubBehaviors.Count; i++) | ||
26 | { | ||
27 | if (subs.SubBehaviors[i] is FollowPathBehavior) | ||
28 | { | ||
29 | DrawableBehaviorGoTo.DrawFollowPath(subs.SubBehaviors[i] as FollowPathBehavior, | ||
30 | batch); | ||
31 | } | ||
32 | |||
33 | } | ||
34 | } | ||
26 | } | 35 | } |
27 | } | 36 | } |
28 | } | 37 | } |
Download diff