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) { } }
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) { } }
public void Awake() { Debug.Log("Initializing AI attribute manager."); this.maxTiersLimit = Attributes.MAX_NUM_OF_LEVELS; this.tiers = new List<TierUpgrade>(); for (int i = 0; i < this.maxTiersLimit; i++) { TierUpgrade tier = new TierUpgrade(); if (i == 0) { tier.level = i + 1; tier.health = 3f; tier.attack = 1f; tier.speed = 1.2f; tier.split = 2f; tier.merge = 2f; tier.attackCooldown = 3f; } else { TierUpgrade previous = this.tiers[i - 1]; tier.level = i + 1; tier.health = previous.health * 2f; tier.attack = previous.attack * 1.2f; tier.speed = previous.speed * 1.2f; tier.split = previous.split * 2f; tier.merge = previous.merge * 2f; tier.attackCooldown = previous.attackCooldown; } this.tiers.Add(tier); } GameObject tempAttribute = GameObject.FindGameObjectWithTag("AIAttributePanel"); if (tempAttribute != null) { this.attributePanelUI = tempAttribute.GetComponent<AttributePanelUI>(); if (this.attributePanelUI == null) { Debug.LogError("Something is not right."); } } //If tempAttribute is null, then it means the game does not allow the player to do customizations. //This means, the only scenario that doesn't allow the player to make customizations would be in //the menu screen, where the AI players are duking out without player's interventions. }