예제 #1
0
    public void TargetCharacter(Character character)
    {
        if (HasTarget())
        {
            trait0Button.onClick.RemoveAllListeners();
            trait1Button.onClick.RemoveAllListeners();
            trait2Button.onClick.RemoveAllListeners();
        }

        target = character;

        Character.Trait trait0 = character.traitsAndMagnitudes[0].trait;
        Character.Trait trait1 = character.traitsAndMagnitudes[1].trait;
        Character.Trait trait2 = character.traitsAndMagnitudes[2].trait;

        trait0Button.image.sprite = traitsManager.traitsSprites[(int)trait0];
        trait1Button.image.sprite = traitsManager.traitsSprites[(int)trait1];
        trait2Button.image.sprite = traitsManager.traitsSprites[(int)trait2];

        trait0Button.onClick.AddListener(() => TraitButtonClicked(trait0));
        trait1Button.onClick.AddListener(() => TraitButtonClicked(trait1));
        trait2Button.onClick.AddListener(() => TraitButtonClicked(trait2));

        characterImage.sprite = character.traitsSprite;
    }
예제 #2
0
    void TraitButtonClicked(Character.Trait trait)
    {
        Transform  canvas            = GameObject.Find("Canvas").GetComponent <Transform>();
        GameObject traitUpgradePopup = GameObject.Instantiate(traitsManager.traitUpgradePopupScreen[( int )trait], canvas, false);
        Screen_Upgrade_Trait_Popup_Manager traitUpgradePopupManager = traitUpgradePopup.GetComponent <Screen_Upgrade_Trait_Popup_Manager>();

        traitUpgradePopupManager.TargetCharacter(target);
    }
예제 #3
0
    public void ShowScreen(string characterName)
    {
        gameObject.SetActive(true);
        characterNameText.text = characterName;
        Character character = defaultCharactersManager.GetDefaultCharacter(characterName);

        characterBioText.text = character.bio;
        characterImage.sprite = character.selectCharacterSprite;

        Character.Trait trait0 = character.traitsAndMagnitudes[0].trait;
        Character.Trait trait1 = character.traitsAndMagnitudes[1].trait;
        Character.Trait trait2 = character.traitsAndMagnitudes[2].trait;

        trait0Button.image.sprite = traitsManager.traitsSprites[(int)trait0];
        trait1Button.image.sprite = traitsManager.traitsSprites[(int)trait1];
        trait2Button.image.sprite = traitsManager.traitsSprites[(int)trait2];

        trait0Button.onClick.AddListener(() => TraitButtonClicked(trait0));
        trait1Button.onClick.AddListener(() => TraitButtonClicked(trait1));
        trait2Button.onClick.AddListener(() => TraitButtonClicked(trait2));
    }
예제 #4
0
 void TraitButtonClicked(Character.Trait trait)
 {
     GameObject spawnedTrait = GameObject.Instantiate(traitsManager.traitsPopupScreens[( int )trait], traitPopupParent, false);
 }