示例#1
0
 protected virtual void Start()
 {
     currentHealth  = startingHealth;
     currentShield  = startingShield;
     regenTimer     = regenDelay;
     ammoDrop       = gameObject.GetComponent <AmmoDrop>();
     gameover       = GameObject.FindWithTag("WorldController").GetComponent <GameOver>();
     gameController = GameObject.FindWithTag("WorldController").GetComponent <GameController>();
 }
示例#2
0
    private IEnumerator Die()
    {
        AmmoDrop ammoDrop = Instantiate(ammoPrefab, transform.position, transform.rotation).GetComponent <AmmoDrop>();

        ammoDrop.amount = Random.Range(minAmmoAmount, maxAmmoAmount);
        StopCoroutine(enemyComponent.Attack(this, target));
        dead          = true;
        agent.enabled = false;
        GetComponent <ShowBehindWalls>().active = false;
        Rigidbody rb = gameObject.AddComponent <Rigidbody>();

        rb.AddForce(Random.insideUnitSphere, ForceMode.VelocityChange);
        yield return(new WaitForSeconds(corpseTimer));

        Destroy(gameObject);
    }