示例#1
0
    /// <summary>
    ///
    /// this is used to check to see if we can shoot the player every frame
    /// and if the enemy is behind the player then we deactivate the enemy
    /// sending them to the object pool
    ///
    /// <para>Author: Callum Dunstone</para>
    ///
    /// </summary>
    protected void Update()
    {
        rangedAttack.Update();
        rangedAttack.AttackPlayer();

        if (player.transform.position.z > (transform.position.z + despawnOffset))
        {
            TurnOff();
        }
    }
示例#2
0
    /// <summary>
    ///
    /// this is used to check to see if we can shoot the player every frame
    /// and if the enemy is behind the player then we deactivate the enemy
    /// sending them to the object pool
    ///
    /// <para>Author: Callum Dunstone</para>
    ///
    /// </summary>
    protected void Update()
    {
        //check if we can shoot the player
        rangedAttack.AttackPlayer();
        rangedAttack.Update();

        //check if we are behind the player and if so deactivate our selves
        if (player.transform.position.z > (transform.position.z + despawnOffset))
        {
            spawner.GetListOfEnemies().Remove(this);

            TurnOff();
        }
    }