public void Copy(AIUnit original) { this.currentState = original.currentState; this.splitFactor = original.splitFactor; this.mergeFactor = original.mergeFactor; this.attackCooldownFactor = original.attackCooldownFactor; this.attackFactor = original.attackFactor; this.unitManager = original.unitManager; this.currentHealth = original.currentHealth; this.maxHealth = original.maxHealth; this.splitCounter = original.splitCounter; this.minimapCameraRect = original.minimapCameraRect; this.teamFaction = original.teamFaction; this.SetTeamColor(original.teamColorValue); AILineOfSight myLOS = this.GetComponentInChildren <AILineOfSight>(); AILineOfSight originalLOS = original.GetComponentInChildren <AILineOfSight>(); AIAttackRange myAR = this.GetComponentInChildren <AIAttackRange>(); AIAttackRange originalAR = original.GetComponentInChildren <AIAttackRange>(); myLOS.teamFaction = originalLOS.teamFaction; myAR.teamFaction = originalAR.teamFaction; }
public void Copy(AIUnit original) { this.currentState = original.currentState; this.splitFactor = original.splitFactor; this.mergeFactor = original.mergeFactor; this.attackCooldownFactor = original.attackCooldownFactor; this.attackFactor = original.attackFactor; this.unitManager = original.unitManager; this.currentHealth = original.currentHealth; this.maxHealth = original.maxHealth; this.splitCounter = original.splitCounter; this.minimapCameraRect = original.minimapCameraRect; this.teamFaction = original.teamFaction; this.SetTeamColor(original.teamColorValue); AILineOfSight myLOS = this.GetComponentInChildren<AILineOfSight>(); AILineOfSight originalLOS = original.GetComponentInChildren<AILineOfSight>(); AIAttackRange myAR = this.GetComponentInChildren<AIAttackRange>(); AIAttackRange originalAR = original.GetComponentInChildren<AIAttackRange>(); myLOS.teamFaction = originalLOS.teamFaction; myAR.teamFaction = originalAR.teamFaction; }
public void Start() { this.startAIFlag = false; this.unitCount = 0; if (this.maxUnitCount <= 0) { this.maxUnitCount = 50; } this.difficulty = Difficulty.Easy; this.UpdateDifficulty(this.difficulty); this.tickIntervalCounter = UnityEngine.Random.Range(0f, this.tickIntervals + 1f); this.currentFiniteState = FSMState.Wait; this.removeUnitList = new List<AIUnit>(); this.selectedUnits = new List<AIUnit>(); this.spawnList = new List<AIUnit>(); this.splitGroupList = new List<SplitGroup>(); this.mergeGroupList = new List<MergeGroup>(); this.splitPercentage = 0f; this.mergePercentage = 0f; this.scoutPercentage = 0f; this.isSingleAIPlayer = false; this.hasLostTheGame = false; AIManager.Instance = this; }
public void InitializeSimulation() { if (this.yellowTeam != null) { //AI Unit spawning. GameObject obj = MonoBehaviour.Instantiate(this.AIUnitPrefab) as GameObject; obj.transform.SetParent(this.yellowTeamUnits.transform); obj.transform.position = this.yellowTeamStartPosiiton.position; AIUnit unit = obj.GetComponent<AIUnit>(); //AI manager spawning. AIManager AImanager = this.yellowTeam.GetComponentInChildren<AIManager>(); if (AImanager != null) { this.yellowTeamAI = AImanager; unit.unitManager = AImanager; unit.teamFaction = AImanager.teamFaction; unit.SetTeamColor(YELLOW_TEAM_INDEX); AImanager.Deactivate(); } } if (this.blueTeam != null) { //AI Unit spawning. GameObject obj = MonoBehaviour.Instantiate(this.AIUnitPrefab) as GameObject; obj.transform.SetParent(this.blueTeamUnits.transform); obj.transform.position = this.blueTeamUnits.position; AIUnit unit = obj.GetComponent<AIUnit>(); //AI manager spawning. AIManager AImanager = this.blueTeam.GetComponentInChildren<AIManager>(); if (AImanager != null) { this.blueTeamAI = AImanager; unit.unitManager = AImanager; unit.teamFaction = AImanager.teamFaction; unit.SetTeamColor(BLUE_TEAM_INDEX); AImanager.Deactivate(); } } }
public void Start() { if (this.aiManager == null) { this.aiManager = GameObject.FindObjectOfType<AIManager>(); if (this.aiManager == null) { Debug.LogError("There's something wrong with AI Manager. Please check."); } } if (this.counter == null) { Debug.LogError("Please check if the counter Text UI element has been set."); } this.previousMaxUnitLimit = 0; this.previousMergeRatio = 0f; this.previousScoutRatio = 0f; this.previousSplitRatio = 0f; }