Esempio n. 1
0
    void SetVariablesToChild()
    {
//main objects that are crucial for the ai brain to function
        childScript.patrolManager = patrolManager; //the patrol manager
        childScript.sensorParent  = sensorParent;  //the parent that holds the sensors
        childScript.ears          = ears;          //the ears object
        childScript.sight         = sight;         //the sight object
        childScript.model         = model;         //the object that holds the model

//data about self, eg height, health
        childScript.eyeHeight = eyeHeight;                                 //the height of the eyes
        childScript.health    = health;                                    //the amount of health the ai has at the start
        childScript.disengagingHitsToKnockout = disengagingHitsToKnockout; //the amount of disengaging hits the ai can take until it gets disengaged
        childScript.radius = radius;                                       //the size of our radius for the navmesh agent
        childScript.height = height;                                       //our height, for the nav mesh agent

//data about enemies, such as height, tag etc..
        childScript.tagOfEnemy          = tagOfEnemy;          //the tag of the enemy
        childScript.tagOfBullet         = tagOfBullet;         //the tag of the object that shows danger, eg bullets
        childScript.enemyCriticalHeight = enemyCriticalHeight; //the height at which the ai should aim
        childScript.initAmmo            = initAmmo;            //the amount of ammo at the start

//reaction times, how quick does the ai react etc...
        childScript.shockTime                       = shockTime;                       //seconds, how quickly we react to seeing an enemy, reference and manipulated by anderenaline
        childScript.freezeTime                      = freezeTime;                      //seconds, how long we freeze when we hear a bullet
        childScript.minCoverTime                    = minCoverTime;                    //seconds, minimum amount of time to hide in cover
        childScript.maxCoverTime                    = maxCoverTime;                    //seconds, maximum amount of time to hide in cover
        childScript.timeBetweenEnemyChecks          = timeBetweenEnemyChecks;          //seconds, amount of time when we check whether the others are a danger or not
        childScript.timeForGivingUpDuringEngagement = timeForGivingUpDuringEngagement; //seconds, the amount of time the ai will try and locate the enemy during an engagment before giving up and going back to patrol
        childScript.timeForGivingUpSeeking          = timeForGivingUpSeeking;          //frames, the amount of time the ai will try and locate the enemy if we suddenly see somebody else before giving up and going back to patrol

//emotion control
        childScript.initAndrenaline = initAndrenaline; //the amount of andrenaline we start off with
        childScript.initFear        = initFear;        //the amount of fear the ai starts off with
        childScript.chanceForFight  = chanceForFight;  //the percentage for fight or flight instict, reference manipulated by andrenaline

//weapons and engagement
        childScript.weapon = weapon;                                          //the weapon object
        childScript.weaponHoldingLocation            = weaponHoldingLocation; //the object where the weapon is held
        childScript.otherWeapons                     = otherWeapons;
        childScript.otherWeaponsMelee                = otherWeaponsMelee;
        childScript.targetCheck                      = targetCheck;                      //the name of the script that return whether the ai should attack or not
        childScript.targetVisualCheckChance          = targetVisualCheckChance;
        childScript.distanceToEngageCloseCombatLogic = distanceToEngageCloseCombatLogic; //the distance at which to engage
        childScript.offsetFactor                     = offsetFactor;

//speed references
        childScript.refSpeedPatrol = refSpeedPatrol; //the reference speed for the patrol
        childScript.refSpeedEngage = refSpeedEngage; //the reference speed for when the ai engages
        childScript.refSpeedChase  = refSpeedChase;  //the reference speed for chase
        childScript.refSpeedCover  = refSpeedCover;  //the refernce speed at which the ai runs to cover

//model stuff
        childScript.modelParentOfAllBones = modelParentOfAllBones; //the parent object that takes in all bones
        childScript.handToUseInCharacter  = handToUseInCharacter;

//patrol sutff
        childScript.waypointList = waypointList;                                         //the list that contains all waypoinjts in correct order
        childScript.distanceToWaypointForRegistering = distanceToWaypointForRegistering; //how far we have to be from the waypoint for it to register that we are at it
        childScript.navmeshToUse = navmeshToUse;                                         //the navmesh to use
        childScript.patrolMinDistanceToDestination = patrolMinDistanceToDestination;
        childScript.patrolFramesCriticalCheck      = patrolFramesCriticalCheck;
        childScript.patrolChecksCritical           = patrolChecksCritical;

//optimisation stuff
        childScript.coverAmountOfRays    = coverAmountOfRays;    //the amount of rays that should be used to sample cover (the more the better, more slower)
        childScript.coverFieldOfView     = coverFieldOfView;     //the field of view from which we find cove (recommend 360 for most cases)
        childScript.coverDistanceToCheck = coverDistanceToCheck; //how far should the rays shoot; usually some arbitary large number
        childScript.patrolTickBarrier    = patrolTickBarrier;    //this is how often the ai brain should check the patroling
        childScript.coverTrueCoverTest   = coverTrueCoverTest;

//melee stuff
        childScript.meleeSetting           = meleeSetting;
        childScript.distanceForMeleeAttack = distanceForMeleeAttack;

        childScript.SetVariablesToAI();
    }