Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Nodes: Star Wars
            TalentTreeNode push       = new TalentTreeNode("Force Push", true);
            TalentTreeNode saberThrow = new TalentTreeNode("Force Saber Throw", true);
            TalentTreeNode lightning  = new TalentTreeNode("Force Lightning", true);
            TalentTreeNode shield     = new TalentTreeNode("Force Lightning Shield", false);
            TalentTreeNode slash      = new TalentTreeNode("Sith Slash", false);
            TalentTreeNode repulse    = new TalentTreeNode("Force Repulse", false);
            TalentTreeNode sling      = new TalentTreeNode("Sith Sling", false);

            //Node Relationships
            push.Left        = saberThrow;
            push.Right       = lightning;
            saberThrow.Left  = shield;
            saberThrow.Right = slash;
            lightning.Left   = repulse;
            lightning.Right  = sling;

            //Known Abilities
            Console.WriteLine("Known Abilities: ");
            push.ListKnownAbilities(push);

            //INDENT
            Console.WriteLine();

            //Possible Abilities
            Console.WriteLine("Possible Abilities: ");
            push.ListPossibleAbilities(push);

            //DEBUG
            Console.ReadLine();
        }
Exemplo n.º 2
0
 //Construtor
 public TalentTreeNode(string name, bool learned)
 {
     abilityName = name;
     hasLearned  = learned;
     left        = null;
     right       = null;
 }
Exemplo n.º 3
0
 public void ListPossibleAbilities(TalentTreeNode current)
 {
     if (current != null)
     {
         ListPossibleAbilities(current.Left);
         if (current.hasLearned == false)
         {
             Console.WriteLine(current.abilityName);
         }
         ListPossibleAbilities(current.Right);
     }
 }
Exemplo n.º 4
0
 //Recursion
 public void ListKnownAbilities(TalentTreeNode current)
 {
     if (current != null)
     {
         if (current.hasLearned == true)
         {
             ListKnownAbilities(current.Left);
             Console.WriteLine(current.abilityName);
             ListKnownAbilities(current.Right);
         }
     }
 }