예제 #1
0
    IEnumerator Mooving()
    {
        t = 0f;
        Vector3 NewPlayerPosition;

        for (int i = 0; i <= Steps; i++)
        {
            while (!MainSettings.NotPause)
            {
                yield return(null);
            }
            tmp = bezie.GetBezie(t, BeziePosition);
            NewPlayerPosition = new Vector3(tmp.x, tmp.y, transform.position.z);
            Vector3    direction  = NewPlayerPosition - transform.position;
            Quaternion toRotation = Quaternion.LookRotation(transform.forward, direction);
            transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, 10 * Time.time);
            transform.position = NewPlayerPosition;
            t += dt;
            if (i == Steps / 2)
            {
                MainSettings.CurPoolManager.GetObject(ShotBullet.transform.name, new Vector3(transform.position.x, transform.position.y, -10), Quaternion.Euler(0, 0, 0));
            }
            yield return(null);
        }
        MainSettings.Enemylist.Remove(gameObject);
        po.ReturnToPool();
    }
예제 #2
0
    IEnumerator Mooving()
    {
        float   t;
        float   dt = 1f / Steps;
        Vector3 NewPlayerPosition;

        Vector2[] BeziePosition = new Vector2[4];
        while (true)
        {
            while (!MainSettings.NotPause)
            {
                yield return(null);
            }
            BeziePosition = GetPosition(BeziePosition);
            t             = 0f;
            for (int i = 0; i <= Steps; i++)
            {
                while (!MainSettings.NotPause)
                {
                    yield return(null);
                }
                NewPlayerPosition  = bezie.GetBezie(t, BeziePosition);
                transform.position = new Vector3(NewPlayerPosition.x, NewPlayerPosition.y, transform.position.z);
                t += dt;
                yield return(null);
            }
            StartCoroutine(Fire(5));
            if (roundCount == MainShotStep)
            {
                mainShot.SetActive(true);
                yield return(new WaitForSeconds(2f));

                StartCoroutine(Fire(5));
                yield return(new WaitForSeconds(2f));

                StartCoroutine(Fire(5));
                yield return(new WaitForSeconds(2f));

                StartCoroutine(Fire(5));
                yield return(new WaitForSeconds(2f));

                StartCoroutine(Fire(5));
                yield return(new WaitForSeconds(2f));

                mainShot.SetActive(false);
            }
            else
            {
                yield return(new WaitForSeconds(TimeFreezing));
            }
        }
    }
예제 #3
0
    IEnumerator Mooving()
    {
        while (!MainSettings.NotPause)
        {
            yield return(null);
        }
        float   t = 0f;
        Vector2 playerPosition = new Vector2(Player.transform.position.x, Player.transform.position.y);

        Vector2[] tmp;
        Vector3   NewPlayerPosition;

        while (true)
        {
            if (CornerCounter == 0 || CornerCounter == 2)
            {
                StartCoroutine(Fire());
                yield return(new WaitForSeconds(TimeFreezing));

                playerPosition = new Vector2(Player.transform.position.x, Player.transform.position.y);
            }
            t = 0f;
            float dt = 1f / Steps;
            tmp = GetBezieDots(playerPosition);
            for (int i = 0; i <= Steps; i++)
            {
                while (!MainSettings.NotPause)
                {
                    yield return(null);
                }
                NewPlayerPosition  = bezie.GetBezie(t, tmp);
                transform.position = new Vector3(NewPlayerPosition.x, NewPlayerPosition.y, transform.position.z);
                t += dt;
                yield return(null);
            }
        }
    }
예제 #4
0
    IEnumerator StartInitiate()
    {
        while (!MainSettings.NotPause)
        {
            yield return(null);
        }
        transform.localRotation = Quaternion.Euler(new Vector3(-230, 100, 50));
        transform.localScale    = new Vector3(0, 0, 0);
        float t = 0f;

        Vector2[] BeziePosition = new Vector2[4];
        Vector3   NewPlayerPosition;

        t = 0f;
        float dt = 1f / Steps;

        BeziePosition[0] = new Vector2(Position.x + 50, Position.y - 50);
        BeziePosition[1] = new Vector2(Position.x, Position.y - 100);
        BeziePosition[2] = new Vector2(Position.x - 100, Position.y);
        BeziePosition[3] = new Vector2(Position.x, Position.y);
        Bezie bezie = new Bezie();

        for (int i = 0; i <= Steps; i++)
        {
            while (!MainSettings.NotPause)
            {
                yield return(null);
            }
            NewPlayerPosition       = bezie.GetBezie(t, BeziePosition);
            transform.localPosition = new Vector3(NewPlayerPosition.x, NewPlayerPosition.y, transform.position.z);
            t += dt;
            transform.rotation   = Quaternion.Lerp(transform.rotation, Quaternion.Euler(Rotation), Time.deltaTime * Speed * 2f);
            transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(4, 4, 4), Time.deltaTime * Speed);
            yield return(null);
        }
    }