Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     timer  = 90;
     player = Player.GetComponent <DamageHandler>();
     enemy  = Enemy.GetComponent <EnemyDamageHandler>();
     StartCoroutine("LoseTime");
 }
Exemplo n.º 2
0
    void Start()
    {
        _player = GameObject.Find("Player").GetComponent <DamageHandler>();
        _enemy  = GameObject.Find("Enemy").GetComponent <EnemyDamageHandler>();

        _playerHealthValue  = GameObject.Find("PlayerHealthValue");
        _playerHealthNumber = GameObject.Find("PlayerHealthNumber").GetComponent <Text>();
        _playerHealthMax    = GameObject.Find("PlayerHealthMax").GetComponent <Text>();

        _enemyHealthValue  = GameObject.Find("EnemyHealthValue");
        _enemyHealthNumber = GameObject.Find("EnemyHealthNumber").GetComponent <Text>();
        _enemyHealthMax    = GameObject.Find("EnemyHealthMax").GetComponent <Text>();

        _playerHealthMax.text = "/" + MAX_HEALTH;
        _enemyHealthMax.text  = "/" + MAX_HEALTH;
    }
    // Update is called once per frame
    void Update()
    {
        if (readyToShoot && withinAttackDistance())
        {
            sa.hullcurrent -= getEnemyDamageValue();
            Instantiate(bullet, transform.position + getBulletOffset(), transform.rotation);

            readyToShoot = false;

            if (stopAfterShoot)
            {
                EnemyMoveForward emf = transform.GetComponent <EnemyMoveForward>();
                emf.stop = true;
            }

            if (dieAfterShoot)
            {
                EnemyDamageHandler edh = transform.GetComponent <EnemyDamageHandler>();
                edh.health = 0;
            }
        }
    }
 void Start()
 {
     edh = transform.GetComponent <EnemyDamageHandler> ();
 }