Beispiel #1
0
    private void DisplayBehavior(BehaviorNodeDebug nodeDebug)
    {
        string text = string.Format("{0} ({1})", nodeDebug.NodeName, nodeDebug.NodeState);

        if (nodeDebug.Children != null)
        {
            nodeDebug.IsFoldout = GUILayout.Toggle(nodeDebug.IsFoldout, text, new GUILayoutOption[0]);
            if (nodeDebug.IsFoldout)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(15f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                for (int i = 0; i < nodeDebug.Children.Length; i++)
                {
                    this.DisplayBehavior(nodeDebug.Children[i]);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                return;
            }
        }
        else
        {
            GUILayout.Label(text, new GUILayoutOption[0]);
        }
    }
Beispiel #2
0
 protected virtual void ExecuteMainTask()
 {
     if (this.CurrentMainTask != null)
     {
         if (this.CurrentMainTask.TargetGuid.IsValid && (this.MainAttackableTarget == null || this.MainAttackableTarget.GUID != this.CurrentMainTask.TargetGuid))
         {
             IGameEntity gameEntity = null;
             this.gameEntityRepositoryService.TryGetValue(this.CurrentMainTask.TargetGuid, out gameEntity);
             this.MainAttackableTarget = (gameEntity as IGarrisonWithPosition);
         }
         int num = (int)this.CurrentMainTask.Behavior.Behave(this);
         if (this.DebugNode == null || !this.DebugNode.IsFoldout)
         {
             this.DebugNode = this.CurrentMainTask.Behavior.DumpDebug();
         }
         if (num == 3)
         {
             this.State = TickableState.NeedTick;
             return;
         }
         this.CurrentMainTask.Behavior.Reset();
         return;
     }
     else
     {
         if (this.defaultBehavior == null)
         {
             this.DebugNode     = null;
             this.State         = TickableState.NoTick;
             this.BehaviorState = ArmyWithTask.ArmyBehaviorState.Sleep;
             return;
         }
         int num2 = (int)this.defaultBehavior.Behave(this);
         if (this.DebugNode == null || !this.DebugNode.IsFoldout)
         {
             this.DebugNode = this.defaultBehavior.DumpDebug();
         }
         if (num2 == 3)
         {
             this.State = TickableState.NeedTick;
             return;
         }
         this.defaultBehavior.Reset();
         return;
     }
 }