Esempio n. 1
0
    public IEnumerator Behave007(Vector2 position, float angle, GameObject originalShot)
    {
        transform.position = position;
        Speed      = StgFrame.height / 2f;
        this.Angle = angle;

        while (true)
        {
            yield return(Yielder.WaitForFixedSeconds(0.06f));

            Fire(originalShot, StgFrame.height / 1.5f, angle + 180f + Mathfd.Shake(30f));
        }
    }
Esempio n. 2
0
    //public IEnumerator Behave010(float lr,float fromY,float toX,float toY,float t,bool another = false)
    //{
    //    transform.position = new Vector3(StgFrame.centerX + (StgFrame.halfWidth + StgFrame.shakeRange + bodyR) * lr, fromY);
    //    SetDestAtTime(toX, toY, t);
    //    //move
    //    while (speed != 0)
    //    {

    //    }
    //}

    public IEnumerator Behave200(GameObject originalShot)
    {
        var enemy = GetComponent <Enemy>();

        transform.position = new Vector3(StgFrame.centerX, StgFrame.topS + BodyRadius);
        SetDestAtTime(X, StgFrame.PY(0.7f), 1);
        yield return(WaitForStop());

        while (enemy.GetHPP() > 0.6f)
        {
            for (var lr = -1; lr <= 1; lr += 2)
            {
                for (var i = 0; i < 3; i++)
                {
                    FireWay(originalShot, 15, 1, StgFrame.height / 2.5f, Angle2Player);
                    yield return(Yielder.WaitForFixedSeconds(0.46f));
                }
                yield return(Behave201(originalShot, lr, true));

                yield return(Yielder.WaitForFixedSeconds(1));

                FireRound(originalShot, 30, StgFrame.height / 3.2f, Mathfd.RandomAngle());
                yield return(Yielder.WaitForFixedSeconds(0.8f));

                yield return(Behave201(originalShot, lr));

                yield return(Behave201(originalShot, -lr, true));

                yield return(Yielder.WaitForFixedSeconds(1));
            }
        }

        while (enemy.GetHPP() > 0f)
        {
            for (var lr = -1; lr <= 1 && enemy.GetHPP() > 0f; lr += 2)
            {
                for (var lr2 = -1; lr2 <= 1; lr2 += 2)
                {
                    SetDestAtTime(StgFrame.PX(Random.Range(0.4f, 0.7f) * lr * lr2), StgFrame.PY(Random.Range(0.7f, 0.8f)), 2);
                    for (var i = 0; i < 6; i++)
                    {
                        yield return(Yielder.WaitForFixedSeconds(0.2f));

                        FireRoundWay(originalShot, 3, 3, 3, StgFrame.height / 2.2f, Mathfd.RandomAngle());
                    }
                    yield return(WaitForStop());

                    SetDestAtTime(X, StgFrame.PY(-0.8f), 0.7f);
                    yield return(WaitForStop());

                    for (var i = 0; i < 2; i++)
                    {
                        CreateBehave007Actor(originalShot, transform, 90 + Mathfd.Shake(2), originalShot);
                        yield return(Yielder.WaitForFixedSeconds(0.5f));
                    }
                }

                SetDestAtTime(StgFrame.centerX, StgFrame.centerY, 3);
                yield return(WaitForStop());

                Angle = -90;

                {
                    float speed    = StgFrame.height * 0.8f;
                    float interval = 1.4f;
                    for (var i = 0; i < 20; i++)
                    {
                        for (var j = 0; j < 8; j++)
                        {
                            Fire(originalShot, Random.Range(speed, speed * 0.6f), Angle2Player + Mathfd.Shake(4));
                        }
                        yield return(Yielder.WaitForFixedSeconds(interval));

                        speed    = Mathf.Min(StgFrame.height * 1.4f, speed + StgFrame.height * 0.2f);
                        interval = Mathf.Max(0.2f, interval - 0.3f);
                    }
                }
                yield return(Yielder.WaitForFixedSeconds(1f));
            }
        }
    }