Beispiel #1
0
        public SpellSelector(AIFighter fighter, EnvironmentAnalyser environment)
        {
            this.m_environment = environment;
            this.Fighter       = fighter;
            this.Possibilities = new System.Collections.Generic.List <SpellCastInformations>();
            this.Priorities    = new System.Collections.Generic.Dictionary <SpellCategory, int>
            {
                {
                    SpellCategory.Summoning,
                    5
                },

                {
                    SpellCategory.Buff,
                    4
                },

                {
                    SpellCategory.Damages,
                    3
                },

                {
                    SpellCategory.Healing,
                    2
                },

                {
                    SpellCategory.Curse,
                    1
                }
            };
        }
Beispiel #2
0
 public SpellSelector(AIFighter fighter, EnvironmentAnalyser environment)
 {
     m_environment = environment;
     Fighter       = fighter;
     Possibilities = new List <SpellCastImpact>();
     Priorities    = new Dictionary <SpellCategory, int>
     {
         { SpellCategory.Summoning, 5 },
         { SpellCategory.Buff, 4 },
         { SpellCategory.Damages, 3 },
         { SpellCategory.Healing, 2 },
         { SpellCategory.Curse, 1 }
     };
 }
    public void SetupAI(AISettings settings)
    {
        aiEnabled            = false;
        this.maxLP           = settings.MaxLP;
        this.minimumDistance = settings.MinDistance;
        GetComponent <AIWeaponController>().accuracy         = settings.Accuracy;
        GetComponent <AIWeaponController>().cooldown         = settings.CoolDown;
        GetComponent <AIWeaponController>().maxExtraCooldown = settings.MaxExtraCooldown;
        GetComponent <AIWeaponController>().shootDistance    = settings.ShootDistance;
        GetComponent <AIWeaponController>().Setup();
        if (target == null)
        {
            GameObject go = GameObject.FindGameObjectWithTag(enemyTag);
            if (go != null)
            {
                target = go.transform;
            }
        }

        lp = maxLP;
        this.transform.position = new Vector3(RoundedMath.Mult(Mathf.RoundToInt(this.transform.position.x / boxFactor), boxFactor), this.transform.position.y);

        aiMovement         = GetComponent <AIMovement>();
        aiWeaponController = GetComponent <AIWeaponController>();

        ea                    = new EnvironmentAnalyser();
        aiMemory              = new AIMemory(windowSizeX, windowSizeY, this.transform.position, ea, this, boxFactor);
        generalSolver         = new GeneralSolver(aiMemory);
        aiMemory.MaxAreaWidth = settings.MaxAreaWidth;

        aiToTarget      = new AIGetToTargetActions(aiMemory, generalSolver, aiMovement, this.transform, target, this, minimumDistance, this);
        aiWeaponActions = new AIWeaponActions(aiWeaponController);


        projectileDetector = new ProjectileDetector(this.transform, 10, projectileLayer);
        aiBehaviorTree     = new AIBehaviorTree(aiToTarget, aiWeaponActions, this, projectileDetector);
        if (aiType == AIType.AGGRESSIVE)
        {
            aiBehaviorTree.CreateAndStartAggrassiveAI();
        }
        if (aiType == AIType.DEFENSIVE)
        {
            aiBehaviorTree.CreateAndStartDefensiveAI();
        }

        aiEnabled = true;
    }