/// <summary>
    /// Inicializa los stats generales/comunes de una nave
    /// </summary>
    /// <param name="ship">Nave a inicializar</param>
    /// <param name="baseStats">Stats de la nave a inicializar</param>
    public void InitializeEnemyGeneralStats(GameObject ship, NaveBaseSO baseStats, Vector2 position)
    {
        ship.transform.position = position;
        ShipMovement sm = ship.GetComponent <ShipMovement>();

        sm.SetSpeed(baseStats.movementSpeed);
        sm.SetSystemOnOff(true);

        ShipShootingSystem ss = ship.GetComponent <ShipShootingSystem>();

        ss.SetSystemOnOff(true);
        if (baseStats.bulletNum <= 0)
        {
            ss.SetSystemOnOff(false);
        }
        else
        {
            ss.SetSystemOnOff(true);
            ss.SetShotNumber(baseStats.bulletNum);
            ss.SetBulletSpeed(baseStats.bulletSpeed);
            ss.SetFireRate(baseStats.reloadime);
        }
        ship.GetComponent <EnemyShipManager>().SetAIStatus(true);
        ship.GetComponent <HealthManager>().ReplenishLife();
    }
 /// <summary>
 /// Inicializacion de componentes
 /// </summary>
 /// <remarks>Siempre hacer override en los hijos y base.Awake()!</remarks>
 virtual protected void Awake()
 {
     movementSyst = GetComponent <ShipMovement>();
     shootingSyst = GetComponent <ShipShootingSystem>();
 }
Exemple #3
0
 protected virtual void Awake()
 {
     hm = GetComponent <HealthManager>();
     ss = GetComponent <ShipShootingSystem>();
     ms = GetComponent <ShipMovement>();
 }
 public override void ApplyPowerUp(GameObject toApply)
 {
     ss            = toApply.GetComponent <ShipShootingSystem>();
     previousShots = ss.ShotNumber;
     ss.SetShotNumber(ss.ShotNumber + numberOfShots);
 }