Exemple #1
0
    public IEnumerator RotateBullet()
    {
        while (true)
        {
            if (movingBullet.bulletMoveSpeed <= 0.0f)
            {
                movingBullet.bulletMoveSpeed             = 3.0f;
                movingBullet.bulletDecelerationMoveSpeed = 0.06f;
                if (initializeBullet.bulletNumber <= 2)
                {
                    movingBullet.ChangeRotateAngle(movingBullet.GetAngle() + 25.0f + 180.0f);
                }
                else
                {
                    movingBullet.ChangeRotateAngle(movingBullet.GetAngle() - 25.0f + 180.0f);
                }

                if (rotateCount >= 1)
                {
                    spriteRenderer.sprite         = enemyFire.spriteCollection[79];
                    movingBullet.bulletMoveSpeed  = 2.0f;
                    movingBullet.bulletSpeedState = BulletSpeedState.BULLETSPEEDSTATE_NORMAL;
                    break;
                }
                else
                {
                    spriteRenderer.sprite = enemyFire.spriteCollection[78];
                    rotateCount++;
                }
            }

            yield return(new WaitForEndOfFrame());
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        SpriteRenderer   spriteRenderer   = this.GetComponent <SpriteRenderer>();
        InitializeBullet initializeBullet = this.GetComponent <InitializeBullet>();
        MovingBullet     movingBullet     = this.GetComponent <MovingBullet>();

        if (!initializeBullet.bulletReflect.Equals(BulletReflect.BULLETREFLECT_NONE) && collision.tag.Equals("REFLECTZONE"))
        {
            if (this.gameObject.activeSelf.Equals(true) && reflectCount < reflectLimit)
            {
                reflectCount++;
                if (collision.gameObject.layer.Equals(LayerMask.NameToLayer("REFLECTZONE_LEFTRIGHT")))
                {
                    movingBullet.ChangeRotateAngle(movingBullet.GetAngle() * -1);
                }
                else if ((collision.gameObject.layer.Equals(LayerMask.NameToLayer("REFLECTZONE_TOP"))) ||
                         (collision.gameObject.layer.Equals(LayerMask.NameToLayer("REFLECTZONE_BOTTOM")) && initializeBullet.bulletReflect.Equals(BulletReflect.BULLETREFLECT_CONTAINBOTTOM)))
                {
                    if (movingBullet.GetAngle() >= 0.0f && movingBullet.GetAngle() <= 180.0f)
                    {
                        movingBullet.ChangeRotateAngle(180.0f - movingBullet.GetAngle());
                    }
                    else
                    {
                        movingBullet.ChangeRotateAngle(-180.0f - movingBullet.GetAngle());
                    }
                }

                if (!(collision.gameObject.layer.Equals(LayerMask.NameToLayer("REFLECTZONE_BOTTOM")) && !initializeBullet.bulletReflect.Equals(BulletReflect.BULLETREFLECT_CONTAINBOTTOM)))
                {
                    if (isSpriteChange.Equals(true))
                    {
                        spriteRenderer.sprite = enemyFire.spriteCollection[changeSpriteNumber];
                    }
                    if (isEffectOutput.Equals(true))
                    {
                        StartCoroutine(enemyFire.CreateBulletFireEffect(effectSpriteNumber, scaleDownSpeed, scaleDownTime, alphaUpSpeed, transform.position));
                    }
                }
            }
        }
    }
    public IEnumerator RotateBullet()
    {
        while (true)
        {
            if (movingBullet.bulletMoveSpeed <= 0.0f)
            {
                movingBullet.bulletMoveSpeed  = initializeBullet.bulletNumber.Equals(0) ? 5.0f : 6.0f;
                movingBullet.bulletSpeedState = BulletSpeedState.BULLETSPEEDSTATE_NORMAL;
                movingBullet.ChangeRotateAngle(movingBullet.GetAngle() + 180.0f + (initializeBullet.bulletNumber.Equals(0) ? -35.0f : 35.0f));
                break;
            }

            yield return(new WaitForEndOfFrame());
        }
    }
    public IEnumerator RotateBullet()
    {
        while (true)
        {
            if (movingBullet.bulletMoveSpeed <= 0.0f)
            {
                movingBullet.bulletRotateTime  = 0.0f;
                movingBullet.bulletSpeedState  = BulletSpeedState.BULLETSPEEDSTATE_NORMAL;
                movingBullet.bulletMoveSpeed   = 1.8f;
                movingBullet.bulletRotateState = BulletRotateState.BULLETROTATESTATE_LIMIT;
                movingBullet.ChangeRotateAngle(movingBullet.GetAngle() + ((initializeBullet.bulletNumber % 2).Equals(0) ? 90.0f : -90.0f));
                break;
            }

            yield return(new WaitForEndOfFrame());
        }
    }