public override void check() { strategies = new AIStrat[6] { new AIStratDefend(controled, this), new AIStratAttack(controled, this), new ASBasicKick(controled, this, controled.abilities[0], 1), new ASRandom(controled, this, controled.abilities[1], 2), new ASRandom(controled, this, controled.abilities[2], 3), new ASRandom(controled, this, controled.abilities[3], 4), }; float minheur = 9999; AIStrat strategy = strategies[0]; foreach (AIStrat strat in strategies) { float heur = strat.negativeHeuristic(); if (heur < minheur) { minheur = heur; strategy = strat; } } strategy.control(); updateLatent(); }
private void InitBotBehaviours() { m_animator = GetComponent <Animator>(); m_aiSpawnUnit = m_animator.GetBehaviour <AISpawnUnit>(); m_aiSpawnUnit.SetPlayerEntity(this); m_aiBuildObstacles = m_animator.GetBehaviour <AIBuildObstacle>(); m_aiBuildObstacles.SetPlayerEntity(this); m_aiDestroyObstacles = m_animator.GetBehaviour <AIDestroyObstacle>(); m_aiDestroyObstacles.SetPlayerEntity(this); m_aiFindClosestBuild = m_animator.GetBehaviour <AIFindClosestBuild>(); m_aiRandomActions = m_animator.GetBehaviour <AIRandomActions>(); m_aiMirrorPlayer = m_animator.GetBehaviour <AIMirrorPlayer>(); m_aiCreateTeam = m_animator.GetBehaviour <AICreateTeam>(); m_aiFindCkOnPath = m_animator.GetBehaviour <AIFindCkOnPath>(); m_aiIdle = m_animator.GetBehaviour <AIIdle>(); m_aiStrat = m_animator.GetBehaviour <AIStrat>(); }