Inheritance: UnityEngine.MonoBehaviour
Ejemplo n.º 1
0
        public void Start()
        {
            foreach (Transform child in this.transform)
            {
                MonoBehaviour.Destroy(child.gameObject);
            }
            if (this.attributePanelUI == null)
            {
                GameObject tempObj = GameObject.FindGameObjectWithTag("AIAttributePanel");
                this.attributePanelUI = tempObj.GetComponent <AttributePanelUI>();
                if (this.attributePanelUI == null)
                {
                    Debug.LogError("Something is wrong. Please check.");
                }
            }

            //this.levelTier = MonoBehaviour.Instantiate(this.customFieldPrefab) as GameObject;
            //Text title = this.levelTier.GetComponent<Text>();
            //title.text = "Level Tier";
            //InputField inputField = this.levelTier.GetComponent<InputField>();
            //inputField.text = "1";
            //this.levelTier.transform.SetParent(this.transform);
            foreach (Category cat in Category.Values)
            {
                GameObject temp = MonoBehaviour.Instantiate(this.customFieldPrefab) as GameObject;
                Text       text = temp.GetComponentInChildren <Text>();
                if (text != null)
                {
                    text.text = cat.name;
                }
                InputField field = temp.GetComponentInChildren <InputField>();
                if (field != null)
                {
                    field.text = cat.name;
                }
                temp.transform.SetParent(this.transform);
                RectTransform tempRect = temp.GetComponent <RectTransform>();
                if (tempRect != null)
                {
                    tempRect.localScale = Vector3.one;
                }
            }

            LevelRateHandler aiRateHandler = this.attributePanelUI.levelingRatesObject;

            if (aiRateHandler != null && aiRateHandler.allAttributes != null)
            {
            }
        }
Ejemplo n.º 2
0
 public void Start()
 {
     if (this.attributePanelUI != null) {
         //This is only set if the game allows the player to do customizations to the AI players.
         //Else, the game is in the menu, with the AI players duking out in the background.
         this.aiLevelRateHandler = this.attributePanelUI.aiLevelingRatesObject;
         if (this.aiLevelRateHandler != null && this.aiLevelRateHandler.allAttributes != null) {
             List<LevelRate> healthList = this.aiLevelRateHandler.allAttributes[Category.Health.value];
             List<LevelRate> attackList = this.aiLevelRateHandler.allAttributes[Category.Attack.value];
             List<LevelRate> attackCooldownList = this.aiLevelRateHandler.allAttributes[Category.AttackCooldown.value];
             List<LevelRate> speedList = this.aiLevelRateHandler.allAttributes[Category.Speed.value];
             List<LevelRate> splitList = this.aiLevelRateHandler.allAttributes[Category.Split.value];
             List<LevelRate> mergeList = this.aiLevelRateHandler.allAttributes[Category.Merge.value];
             for (int i = 0; i < this.maxTiersLimit; i++) {
                 TierUpgrade tierUpgrade = this.tiers[i];
                 tierUpgrade.health = healthList[i].rate;
                 tierUpgrade.attack = attackList[i].rate;
                 tierUpgrade.attackCooldown = attackCooldownList[i].rate;
                 tierUpgrade.speed = speedList[i].rate;
                 tierUpgrade.split = splitList[i].rate;
                 tierUpgrade.merge = mergeList[i].rate;
                 this.tiers[i] = tierUpgrade;
             }
         }
         else {
             Debug.LogError("Something is wrong. Please check.");
         }
     }
 }