コード例 #1
0
 /// <summary> Prints the abilities the player could learn next </summary>
 public void ListPossibleAbilites()
 {
     if (!learnedTalent)
     {
         Console.Write(abilityName + ", ");
     }
     else
     {
         if (leftNode != null)
         {
             leftNode.ListPossibleAbilites();
         }
         if (rightNode != null)
         {
             rightNode.ListPossibleAbilites();
         }
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            TalentTreeNode node6 = new TalentTreeNode("Grappling Hook", true);
            TalentTreeNode node5 = new TalentTreeNode("Double Dash", false);
            TalentTreeNode node4 = new TalentTreeNode("Glide", false);
            TalentTreeNode node3 = new TalentTreeNode("Wall Climb", false);
            TalentTreeNode node2 = new TalentTreeNode("Double Jump", false, node4, node3);
            TalentTreeNode node1 = new TalentTreeNode("Dash", true, node6, node5);
            TalentTreeNode node0 = new TalentTreeNode("Sprint", true, node1, node2);

            Console.Write("All Abilites: ");
            node0.ListAllAbilities();

            Console.Write("\n\nLearned Abilites: ");
            node0.ListKnownAblilites();

            Console.Write("\n\nPossible Abilites: ");
            node0.ListPossibleAbilites();

            Console.ReadLine();
        }