Exemplo n.º 1
0
        private void CreateAlien()
        {
            Point point = new Point();

            for (int i = 0; i < 3; i++)
            {
                Alien warper = null;
                switch (i)
                {
                case 0:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 0);
                        warper = new BlueSprite(this, point);
                        listAlien.Add(warper);
                        point  = new Point(70 + (120 * j), 100);
                        warper = new BlueSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }

                case 1:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 200);
                        warper = new GreenSprite(this, point);
                        listAlien.Add(warper);
                        point  = new Point(70 + (120 * j), 300);
                        warper = new GreenSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }

                case 2:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 400);
                        warper = new RedSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }
                }
            }
        }
Exemplo n.º 2
0
        private void CreateAlien()
        {
            Point point = new Point();  //实例化

            for (int j = 0; j < 3; j++)
            {
                Alien wraper = null;
                switch (j)
                {
                case 0:      // BlueSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 0);
                        wraper = new BlueSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 70);
                        wraper = new BlueSprite(this, point);
                    }
                }
                break;

                case 1:             // RedSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 140);
                        wraper = new RedSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 210);
                        wraper = new RedSprite(this, point);
                    }
                }
                break;

                case 2:              // GreenSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 280);
                        wraper = new GreenSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 350);
                        wraper = new GreenSprite(this, point);
                    }
                }
                break;
                }
            }
        }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (IsBeingChasedByCops)
        {
            if (!audioSource.isPlaying && audioSource.clip.isReadyToPlay)
            {
                audioSource.Play();
            }

            swapTimer += Time.deltaTime;

            if (swapTimer >= SwapTime)
            {
                status    = !status;
                swapTimer = 0f;
                RedSprite.SetActive(!status);
                BlueSprite.SetActive(status);
            }
            policeChaseTimer += Time.deltaTime;


            ChangeLevel(policeChaseTimer);
        }
        else
        {
            ChangeLevel(policeChaseTimer);
            if (policeChaseTimer <= 0)
            {
                RedSprite.SetActive(false);
                BlueSprite.SetActive(false);
                policeChaseTimer = 0f;
            }
            else
            {
                policeChaseTimer -= Time.deltaTime;
            }
        }
    }