Exemplo n.º 1
0
    public float frontSensorAngle = 45f;                       //sets angle for secondary front sensor
    #endregion

    #endregion

    // Use this for initialization
    void Awake()
    {
        if (randomAttackState) //if designer chose to have a random attack state use this before anything else
        {
            rng = Random.Range(1, 51);
            if (rng <= 25) //if rng value is less than or equal to 25 select flee
            {
                SwitchTo = TypeofEnemy.Flee;
            }
            else //else if the value is higher choose to attack player
            {
                SwitchTo = TypeofEnemy.sawPlayer;
            }
        }
        motor_           = gameObject.GetComponent <TankMotor>();           //sets motor info from tankdata script
        tankInfo_        = gameObject.GetComponent <TankData>();            //sets speed info from tankdata script
        ammunition_      = gameObject.GetComponent <TankData>().Ammo;       //sets ammo type from tankdata script
        tankTransform_   = gameObject.GetComponent <Transform>();           //grabs transform of tank
        originalState_   = EnemyType;                                       //sets up an original state to default back to based off designer decision
        sensing          = GetComponent <AISensoryScript>();                //grabs sensory input from AISensoryScript
        originPoint      = gameObject.GetComponent <Transform>().position;  //sets up origin point based off tank spawn to go back to (if applicable)
        origlife         = gameObject.GetComponent <TankData>().tankHealth; // sets up life here to use
        origRespawnTime_ = respawnTime;                                     //sets original respawn time to user defined respawn time
        sfxAudio         = GetComponent <AudioSource>();
    }