示例#1
0
    IEnumerator SwarmAttacks()
    {
        // initial left movement
        StandardFireFunctions.FireLeft(gameObject, 48.0f);
        while (transform.position.x > 80)
        {
            yield return(null);
        }

        StartCoroutine(SwarmFire());

        while (true)
        {
            // movement left and right
            if (left)
            {
                StandardFireFunctions.FireLeft(gameObject, 48.0f);
                gameObject.transform.localScale = new Vector2(1, gameObject.transform.localScale.y);
            }
            else
            {
                StandardFireFunctions.FireRight(gameObject, 48.0f);
                gameObject.transform.localScale = new Vector2(-1, gameObject.transform.localScale.y);
            }

            // flip when wall is reached
            if ((transform.position.x > 120 && !left) || (transform.position.x < -100 && left))
            {
                left = !left;
            }

            yield return(null);
        }
    }
示例#2
0
    void ShootBasicProjectiles()
    {
        GameObject proj = Instantiate(gravity_proj, firingPositions[0], transform.rotation);

        StandardFireFunctions.FireRight(proj, 60);
        proj = Instantiate(gravity_proj, firingPositions[1], transform.rotation);
        StandardFireFunctions.FireLeft(proj, 60);
        proj = Instantiate(gravity_proj, firingPositions[2], transform.rotation);
        StandardFireFunctions.FireVeticallyDegreeOffset(proj, 10);
        proj = Instantiate(gravity_proj, firingPositions[2], transform.rotation);
        StandardFireFunctions.FireVeticallyDegreeOffset(proj, -10);
    }
示例#3
0
 void Update()
 {
     if (left)
     {
         StandardFireFunctions.FireLeft(gameObject, speed);
         gameObject.transform.localScale = new Vector2(1, gameObject.transform.localScale.y);
     }
     else
     {
         StandardFireFunctions.FireRight(gameObject, speed);
         gameObject.transform.localScale = new Vector2(-1, gameObject.transform.localScale.y);
     }
 }