Beispiel #1
0
    private void Awake()
    {
        enemyStats = GetComponent <EnemyStats>();

        playerHealth    = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
        playerIntensity = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerIntensity>();
    }
Beispiel #2
0
    //private int intensityIncrease = 2;

    private void Awake()
    {
        enemyStats  = GetComponent <EnemyStats>();
        enemyHealth = GetComponent <EnemyHealth>();
        enemyAttack = GetComponent <EnemyAttack>();
        rigidBody   = GetComponent <Rigidbody>();

        neighbours      = new List <GameObject>();
        previousVectors = new List <Vector3>();

        playerPosition  = GameObject.FindGameObjectWithTag("Player").transform;
        playerIntensity = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerIntensity>();
    }
Beispiel #3
0
    private float intensityFade; // This will hold a randomized value in Fade state for intensity to reach

    private void Start()
    {
        //Instantiate(playerPrefab, transform.position, Quaternion.identity); DEBUG: Player will be placed in the scene manually for now
        //player = GameObject.FindGameObjectWithTag("Player"); // DEBUG: since the camera is attached to it
        playerIntensity = player.GetComponent <PlayerIntensity>(); // Gets the PlayerIntensity

        CurrentState = State.BuildUp;                              // Sets the state to the default

        ActiveEnemies = 0;
        spawned       = new List <GameObject>();
        despawned     = new List <GameObject>();

        //InvokeRepeating("Spawning", 0.5f, 1.0f);
        InvokeRepeating("CheckActiveEnemies", 0.5f, 1.0f);
    }
Beispiel #4
0
    private void Awake()
    {
        enemyStats  = GetComponent <EnemyStats>();
        enemyHealth = GetComponent <EnemyHealth>();
        enemyAttack = GetComponent <EnemyAttack>();

        enemyNavMeshAgent              = GetComponent <NavMeshAgent>();
        enemyNavMeshAgent.enabled      = true;
        enemyNavMeshAgent.updateUpAxis = false;

        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player != null)
        {
            playerPosition  = player.transform;
            playerIntensity = player.GetComponent <PlayerIntensity>();
        }
    }
Beispiel #5
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F12)) // Checks if the button is pressed
        {
            isTurnedOn = !isTurnedOn;
        }

        foreach (Text text in texts)
        {
            if (text.gameObject.Equals(gameObject)) // Turn off if not enabled
            {
                continue;
            }

            if (text.name.Equals("AIDStateText"))
            {
                text.text = "AI Director state: " + aIDirector.CurrentState;
            }
            else if (text.name.Equals("EnemyCountText"))
            {
                text.text = "Enemy Count: " + aIDirector.ActiveEnemies; // Update EnemyCountText
            }
            else if (text.name.Equals("MaxEnemyText"))
            {
                text.text = "Max Enemies: " + aIDirector.MaxEnemies; // Update MaxEnemyText
            }
            else if (text.name.Equals("IntensityText"))
            {
                PlayerIntensity playerIntensity = aIDirector.player.GetComponent <PlayerIntensity>();

                Slider intensityBar = text.transform.GetChild(0).gameObject.GetComponent <Slider>();
                intensityBar.maxValue = playerIntensity.MaxIntensity; // Set max intensity
                intensityBar.value    = playerIntensity.Intensity;    // Update Intensity bar

                Toggle inCombatCheckbox = text.transform.GetChild(1).gameObject.GetComponent <Toggle>();
                inCombatCheckbox.isOn = playerIntensity.IsInCombat; // Update IsInCombat toggle
            }

            text.gameObject.SetActive(isTurnedOn);
        }
    }
    private void Start()
    {
        timeSinceLastAttack = Time.time;

        playerIntensity = GetComponent <PlayerIntensity>();
    }