//private IEnumerator Flash(float waitTime)
    //{
    //    m_spriteRenderer.sprite = white;
    //    yield return new WaitForSeconds(waitTime);

    //    if (color == Projectile.Color.RED)
    //    {
    //        m_spriteRenderer.sprite = red;
    //    }
    //    else if (color == Projectile.Color.BLUE)
    //    {
    //        m_spriteRenderer.sprite = blue;
    //    }
    //    else if (color == Projectile.Color.PURPLE)
    //    {
    //        m_spriteRenderer.sprite = purple;
    //    }
    //    yield break;
    //}
    #endregion

    public void Retaliate(Projectile.Color color)
    {
        foreach (GameObject gun in mainGunsPhase2)
        {
            GameObject newBullet  = pooler.NewObject(projectile, gun.transform.position, Quaternion.identity);
            Projectile bulletComp = newBullet.GetComponent <Projectile>();

            bulletComp.InitializeBulletVelocity(gun.transform.up * 5f);
            bulletComp.AssignColor(color);
            bulletComp.AssignSize(0.5f);
            bulletComp.AssignSprite("Orb");
        }
    }
Beispiel #2
0
    public void Spawn()
    {
        Vector3 vectorToSpawn   = (points[4].transform.position - transform.position);
        float   distanceToSpawn = vectorToSpawn.magnitude;

        Debug.DrawLine(transform.position, transform.position + vectorToSpawn, Color.green);

        transform.position = Vector3.MoveTowards(transform.position, transform.position + vectorToSpawn, 2f * Time.deltaTime);
        if (distanceToSpawn <= 0.01f)
        {
            Debug.Log("Change to colorize");
            color = (Projectile.Color)Random.Range(1, 3);
            ChangeState(ZStates.COLORIZE);
        }
    }
Beispiel #3
0
 private void OnEnable()
 {
     pooler = ObjectPooler.instance;
     if (this.gameObject.tag == "Red")
     {
         color = Projectile.Color.RED;
     }
     else if (this.gameObject.tag == "Blue")
     {
         color = Projectile.Color.BLUE;
     }
     else if (this.gameObject.tag == "Purple")
     {
         color = Projectile.Color.PURPLE;
     }
 }
    private void OnEnable()
    {
        pooler = ObjectPooler.instance;

        projectile = Resources.Load <GameObject>("BasicProjectile");

        if (camera == null)
        {
            camera = Camera.main;
        }

        spawnPoint       = transform.position;
        endPoint         = GenerateEndPoint();
        arcHeight        = -2.5f;
        moveInterpolator = 0;

        color = (Projectile.Color)Random.Range(1, 3);
    }
Beispiel #5
0
    private void OnEnable()
    {
        bossDeathSFX = GetComponent <AudioSource>();
        red          = Resources.Load <Sprite>("boss_red");
        blue         = Resources.Load <Sprite>("boss_blue");
        purple       = Resources.Load <Sprite>("boss_purple");
        white        = Resources.Load <Sprite>("boss_white");

        m_spriteRenderer        = GetComponent <SpriteRenderer>();
        m_spriteRenderer.sprite = purple;
        color = Projectile.Color.PURPLE;

        points       = new List <GameObject>();
        cornerParent = GameObject.Find("ZarPoints");
        gunGimbal    = transform.GetChild(0).gameObject;

        for (int i = 0; i < cornerParent.transform.childCount; i++)
        {
            points.Add(cornerParent.transform.GetChild(i).gameObject);
        }
    }
Beispiel #6
0
    public void Retreat()
    {
        Vector3 vectorToSpawn   = (points[4].transform.position - transform.position);
        float   distanceToSpawn = vectorToSpawn.magnitude;

        Debug.DrawLine(transform.position, transform.position + vectorToSpawn, Color.green);

        transform.position = Vector3.MoveTowards(transform.position, transform.position + vectorToSpawn, speed * Time.deltaTime);
        if (distanceToSpawn <= 0.01f)
        {
            Debug.Log("Change to colorize");
            if (color == Projectile.Color.RED)
            {
                color = Projectile.Color.BLUE;
            }
            else if (color == Projectile.Color.BLUE)
            {
                color = Projectile.Color.RED;
            }
            cornerIncrement = 0;
            ChangeState(ZStates.COLORIZE);
        }
    }
Beispiel #7
0
    void Update()
    {
        if (pooler == null)
        {
            pooler = ObjectPooler.instance;
        }

        isFiring = states.isShooting;
        if (isFiring)
        {
            Debug.Log("ISFIRING");
            color = states.color;
            if (!coroutineStarted)
            {
                StartCoroutine(ShootCoroutine(0.1f));
                coroutineStarted = true;
            }
        }
        else
        {
            StopAllCoroutines();
            coroutineStarted = false;
        }
    }
Beispiel #8
0
    private void OnEnable()
    {
        redGun    = Resources.Load <Sprite>("boss_gun_red");
        blueGun   = Resources.Load <Sprite>("boss_gun_blue");
        redFlash  = Resources.Load <Sprite>("boss_gun_red_WHITE");
        blueFlash = Resources.Load <Sprite>("boss_gun_blue_WHITE");

        spriteRenderer = transform.GetChild(0).GetComponent <SpriteRenderer>();

        layer            = LayerMask.NameToLayer("Projectile");
        parentStates     = transform.parent.parent.GetComponent <DualShockerStates>();
        projectilePrefab = Resources.Load <GameObject>("BasicProjectile");

        if (gameObject.tag == "Red")
        {
            color = Projectile.Color.RED;
        }
        if (gameObject.tag == "Blue")
        {
            color = Projectile.Color.BLUE;
        }

        gunHealth = 20f;
    }