Beispiel #1
0
 private void Start()
 {
     if (!abilitySlots)
     {
         abilitySlots = transform.parent.gameObject.GetComponent <AbilitySlots>();
     }
 }
Beispiel #2
0
    private void Start()
    {
        // Start target container position as current target container position
        containerTargetPosition = buttonContainer.GetComponent <RectTransform>().anchoredPosition;

        // Find the player's ability slots
        abilitySlots = GameObject.FindGameObjectWithTag("Player").GetComponent <AbilitySlots>();

        // Initialize ability points and AP bar
        currentAbilityPoints = maxAbilityPoints;
        APBar.maxValue       = maxAbilityPoints;
        APBar.value          = currentAbilityPoints;

        // Initial set up of ability buttons
        for (int i = 0; i < possibleAbilities.Count; i++)
        {
            // Ignore posiible abilities if they are not set
            if (possibleAbilities[i] == null)
            {
                continue;
            }

            // There are still buttons to be activated
            if (i < abilityButtons.Count)
            {
                SetUpAbilityButton(i, possibleAbilities[i]);
            }
            // There are more abilities than buttons
            else
            {
                AddNewAbilityButton();
                SetUpAbilityButton(i, possibleAbilities[i]);
            }
        }
    }