Ejemplo n.º 1
0
    public Coroutine firingCoroutine;     //coroutine de tir

    // Start is called before the first frame update
    void Awake()
    {
        cooldownTimer         = cooldown;
        ennemy                = GetComponentInParent <Ennemy>();
        playerDetector        = GetComponentInChildren <PlayerDetector>();
        soundEffectsGenerator = GetComponentInChildren <SoundEffectsGenerator>();

        //Find pooler
        for (int i = 0; i < GameManagerScript.current.poolers.Length; i++)
        {
            if (GameManagerScript.current.poolers[i].salvePrefab == bulletPrefab.GetComponent <Salve>())
            {
                pooler = GameManagerScript.current.poolers[i];
            }
        }

        if (isTurretBeam && beam != null)
        {
            beam.damage = globalDamage;
        }
    }
    public Coroutine manualFiringCoroutine;                //coroutine de tir manuel de la tourelle

    public void OnValidate()
    {
        //Initiate turrets stats from its description
        if (descritpion != null)
        {
            updateTurretStats();

            if (descritpion.modifierPrimaryType == ModifierPrimaryType.Beam) //Beam turret
            {
                isTurretBeam = true;
            }

            if (descritpion.actualAmmo > 0) //Turret with ammunitions
            {
                maxAmmo    = descritpion.actualAmmo;
                actualAmmo = maxAmmo;
            }
        }

        soundEffectsGenerator = GetComponentInChildren <SoundEffectsGenerator>();
    }