Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        control     = GetComponent <NPControl>();
        player      = GameObject.FindGameObjectWithTag("Player");
        attackMode  = false;
        animator    = GetComponent <Animator>();
        rb          = GetComponent <Rigidbody2D>();
        boxCollider = GetComponent <BoxCollider2D>();
        lifeManager = GetComponent <LifeManager>();
        chargeLight = GetComponentInChildren <Light2D>();

        if (laserPool == null)
        {
            laserPool = new Queue <Projectiles.Projectile>();
        }

        for (int i = 0; i < maxLaserLength; i++)
        {
            GameObject             laserPart = Instantiate(laser);
            Projectiles.Projectile laserCopy =
                new Projectiles.Projectile(laserPart.GetComponent <Rigidbody2D>(),
                                           laserPart);
            laserPool.Enqueue(laserCopy);
            laserCopy.instance.SetActive(false);
        }

        chargeLight.gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        control     = GetComponent <NPControl>();
        player      = GameObject.FindGameObjectWithTag("Player");
        attackMode  = false;
        animator    = GetComponent <Animator>();
        rb          = GetComponent <Rigidbody2D>();
        boxCollider = GetComponent <BoxCollider2D>();
        lifeManager = GetComponent <LifeManager>();

        if (shieldPool == null)
        {
            shieldPool = new Queue <Projectiles.Projectile>();
        }

        for (int i = 0; i < maxShields; i++)
        {
            GameObject             shieldObject = Instantiate(shield);
            Projectiles.Projectile shieldCopy   =
                new Projectiles.Projectile(shieldObject.GetComponent <Rigidbody2D>(),
                                           shieldObject);
            shieldPool.Enqueue(shieldCopy);
            shieldCopy.instance.SetActive(false);
        }
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        rotationalOffset = Random.Range(0f, 2 * Mathf.PI);
        control          = GetComponent <NPControl>();
        player           = GameObject.FindGameObjectWithTag("Player");
        attackMode       = false;
        animator         = GetComponent <Animator>();
        rb          = GetComponent <Rigidbody2D>();
        boxCollider = GetComponent <BoxCollider2D>();
        lifeManager = GetComponent <LifeManager>();
        if (projectilePool == null)
        {
            projectilePool = new Queue <Projectiles.Projectile>();
        }

        for (int i = 0; i < projectilesPerAttack * maxAttacks; i++)
        {
            GameObject             projectileInstance = Instantiate(projectile);
            Projectiles.Projectile projectileCopy     =
                new Projectiles.Projectile(projectileInstance.GetComponent <Rigidbody2D>(),
                                           projectileInstance);
            projectilePool.Enqueue(projectileCopy);
            projectileCopy.instance.SetActive(false);
        }
    }