public void AssignTrait(Trait newTrait)
 {
     assignedTrait=newTrait;
     nameText.text=newTrait.name;
     GetComponent<Button>().onClick.RemoveAllListeners();
     if (assignedTrait.GetType().BaseType==typeof(Trait)) GetComponent<Button>().image.color=Color.white;
     else
     {
         Skill assignedSkill=assignedTrait as Skill;
         if (assignedSkill.learned) GetComponent<Button>().image.color=Color.white;
         else
         {
             if (InventoryScreenHandler.mainISHandler.selectedMember.skillpoints<1) GetComponent<Button>().image.color=Color.gray;
             else
             {
                 GetComponent<Button>().image.color=Color.green;
                 GetComponent<Button>().onClick.AddListener(
                     ()=>
                     {
                     //if (InventoryScreenHandler.mainISHandler.selectedMember.skillpoints>=1)
                     {
                         //Order is important
                         InventoryScreenHandler.mainISHandler.selectedMember.ActivateSkill(assignedSkill);
                         InventoryScreenHandler.mainISHandler.selectedMember.skillpoints--;
                         InventoryScreenHandler.mainISHandler.RefreshInventoryItems();
                     }
                 });
             }
         }
     }
 }
示例#2
0
    private void PurchaseTrait(Trait trait)
    {
        if (UnlockedTraits.Contains(trait.GetType()))
        {
            return;
        }

        var cost = trait.Cost;

        if (EvolutionPoints < cost)
        {
            return;
        }

        Debug.Log("Purchased " + trait.Name);

        EvolutionPoints -= cost;
        UnlockedTraits.Add(trait.GetType());

        CreateTraitSelectionGui();
    }
示例#3
0
    public void MoveTrait(GameObject newObj)
    {
        if (selectedTrait == null)
        {
            return;
        }

        print("MOVE TRAIT " + selectedTrait.GetName());

        newObj.AddComponent(selectedTrait.GetType());
        selectedTrait.Remove();

        //TODO: properly repopulate appropriate lists
        DisableTraitsMode();
        EnableTraitsMode();
    }