Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        originalY = this.transform.position.y;
        this.gameObject.SetActive(true);

        if (this.gameObject.tag == "EnemyDog")
        {
            enemyHealth = 2f;
        }

        if (this.gameObject.tag == "EnemyDrone")
        {
            enemyHealth = 2f;
        }

        animEnemy        = GetComponent <Animator>();
        enemyRigidbody2D = GetComponent <Rigidbody2D>();
        enemyCollider    = GetComponent <Collider2D>();

        shootingPoint       = GetComponentsInChildren <Transform>();
        localPesInimigo     = GetComponentsInChildren <Transform>();
        enemyVisionCollider = GetComponentsInChildren <BoxCollider2D>();

        scriptPlayerInteraction = GameObject.FindWithTag("Player").gameObject.GetComponent <scrPlayerInteraction>();
        playerTransform         = GameObject.FindWithTag("Player").gameObject.GetComponent <Transform>();
        scriptPontuacao         = GameObject.FindWithTag("Gerenciador").gameObject.GetComponent <scrpontuacao>();
        scriptGerenciaSons      = GameObject.Find("GerenciadorGlobal(Clone)").gameObject.GetComponent <scrGerenciadorSons>();
    }
    // Start is called before the first frame update
    void Start()
    {
        animDrone        = GetComponent <Animator>();
        droneRigidbody2D = GetComponent <Rigidbody2D>();
        originalY        = this.transform.position.y;
        enemyGroup       = GameObject.FindGameObjectsWithTag("EnemyDog");
        enemyGroupLenght = enemyGroup.Length;

        scriptPlayerInteraction = GameObject.FindWithTag("Player").gameObject.GetComponent <scrPlayerInteraction>();
        playerTransform         = GameObject.FindWithTag("Player").gameObject.GetComponent <Transform>();
    }
    //public static TimeSpan FromSeconds(float timer);

    void Start()
    {
        scriptPlayerInteraction = GameObject.Find("Player").gameObject.GetComponent <scrPlayerInteraction>();
        scriptPlayer            = GameObject.Find("Player").gameObject.GetComponent <Player>();
        txtHP     = GameObject.Find("HPText").gameObject.GetComponent <Text>();
        txtAmmo   = GameObject.Find("AmmoText").gameObject.GetComponent <Text>();
        txtPoints = GameObject.Find("PointsText").gameObject.GetComponent <Text>();
        txtTimer  = GameObject.Find("TimerText").gameObject.GetComponent <Text>();
        pontos    = 0;
        timer     = 0;
        wasUnseen = true;
        UpdateUI();
    }