Example #1
0
  private void SendDisk()
  {
      float position_x = 16;

      if (diskQueue.Count != 0)
      {
          GameObject disk = diskQueue.Dequeue();
          notBeShoted.Add(disk);
          disk.SetActive(true);

          float randomY = Random.Range(2f, 4f);
          float offsetX = Random.Range(-1f, 1f) < 0 ? -1 : 1;
          disk.GetComponent <DiskData>().direction = new Vector3(offsetX, randomY, 0);
          Vector3 position = new Vector3(-disk.GetComponent <DiskData>().direction.x *position_x, randomY, 0);
          disk.transform.position = position;

          float pow = Random.Range(10f, 15f);
          float ang = Random.Range(15f, 28f);
          actionManager.UFOFly(disk, ang, pow);
      }

      for (int i = 0; i < notBeShoted.Count; i++)
      {
          GameObject temp = notBeShoted[i];

          if (temp.transform.position.y < -10 && temp.gameObject.activeSelf == true)
          {
              diskFactory.FreeDisk(notBeShoted[i]);
              notBeShoted.Remove(notBeShoted[i]);
              GUI.MinusOneSec();
          }
      }
  }
Example #2
0
    private void SendDisk()
    {
        float position_x = 16;

        if (disk_queue.Count != 0)
        {
            GameObject disk = disk_queue.Dequeue();
            disk_notshot.Add(disk);
            disk.SetActive(true);
            //设置被隐藏了或是新建的飞碟的位置
            float ran_y = Random.Range(1f, 4f);
            float ran_x = Random.Range(-1f, 1f) < 0 ? -1 : 1;
            disk.GetComponent <DiskData>().direction = new Vector3(ran_x, ran_y, 0);
            Vector3 position = new Vector3(-disk.GetComponent <DiskData>().direction.x *position_x, ran_y, 0);
            disk.transform.position = position;
            //设置飞碟初始所受的力和角度
            float power = Random.Range(10f, 15f);
            float angle = Random.Range(15f, 28f);
            action_manager.UFOFly(disk, angle, power);
        }

        for (int i = 0; i < disk_notshot.Count; i++)
        {
            GameObject temp = disk_notshot[i];
            //飞碟飞出摄像机视野也没被打中
            if (temp.transform.position.y < -10 && temp.gameObject.activeSelf == true)
            {
                disk_factory.FreeDisk(disk_notshot[i]);
                disk_notshot.Remove(disk_notshot[i]);
                //玩家血量-1
                user_gui.ReduceBlood();
            }
        }
    }
Example #3
0
    private void SendDisk()
    {
        float position_x = 16;

        if (diskQueue.Count != 0)
        {
            GameObject disk = diskQueue.Dequeue();
            diskNotHit.Add(disk);
            disk.SetActive(true);
            float ran_y = Random.Range(1f, 4f);
            float ran_x = Random.Range(-1f, 1f) < 0 ? -1 : 1;
            disk.GetComponent <DiskData>().direction = new Vector3(ran_x, ran_y, 0);
            Vector3 position = new Vector3(-disk.GetComponent <DiskData>().direction.x *position_x, ran_y, 0);
            disk.transform.position = position;
            float power = Random.Range(10f, 15f);
            float angle = Random.Range(15f, 28f);
            actionManager.UFOFly(disk, angle, power);
        }

        for (int i = 0; i < diskNotHit.Count; i++)
        {
            GameObject temp = diskNotHit[i];
            if (temp.transform.position.y < -10 && temp.gameObject.activeSelf == true)
            {
                diskFactory.FreeDisk(diskNotHit[i]);
                diskNotHit.Remove(diskNotHit[i]);
                userGUI.BloodReduce();
            }
        }
    }
Example #4
0
    //发送飞碟
    private void sendDisk()
    {
        diskCount++;
        DiskModel disk = diskFactory.getDisk(); //从工厂获取新的飞碟

        currentDisks.Add(disk);                 //将新飞碟加入到当前的列表
        actionManager.UFOFly(disk);             //令飞碟进行移动
    }
 public void UFOFly(GameObject disk, float angle, float power, bool op)
 {
     if (op)
     {
         phy_action_manager.UFOFly(disk, angle, power);
     }
     else
     {
         fly_action_manager.UFOFly(disk, angle, power);
     }
 }
Example #6
0
 public void playDisk(GameObject disk, float angle, float power, bool isPhy)
 {
     if (isPhy)
     {
         phy_action_manager.UFOFly(disk, angle, power);
     }
     else
     {
         action_manager.UFOFly(disk, angle, power);
     }
 }
 public void playDisk(GameObject disk, float angle, float power, bool isPhysical)
 {
     if (isPhysical)
     {
         physicalManager.UFOFly(disk, angle, power);
     }
     else
     {
         flyManager.UFOFly(disk, angle, power);
     }
 }
    private void SendDisk()
    {
        float position_x = 16;

        if (disk_queue.Count != 0)
        {
            GameObject disk = disk_queue.Dequeue();
            disk_notshot.Add(disk);
            disk.SetActive(true);
            float ran_y = 6;
            float ran_x = Random.Range(-1f, 1f) < 0 ? -1 : 1;
            if (round == 2)
            {
                disk.GetComponent <DiskComponent>().score = 2;
                float diff = Random.Range(1, 5);
                ran_y -= diff;
            }
            else if (round == 3)
            {
                disk.GetComponent <DiskComponent>().score = 3;
                float diff = Random.Range(6, 9);
                ran_y -= 6;
            }
            disk.GetComponent <DiskComponent>().direction = new Vector3(ran_x, ran_y, 10);
            Vector3 position = new Vector3(-disk.GetComponent <DiskComponent>().direction.x *position_x, ran_y, 15);
            disk.transform.position = position;
            float power = Random.Range(10f, 15f);
            float angle = Random.Range(0, 0);
            bool  flag  = false;
            action_manager.UFOFly(disk, angle, power, flag);
        }

        for (int i = 0; i < disk_notshot.Count; i++)
        {
            GameObject temp = disk_notshot[i];
            if (temp.transform.position.y < -10 && temp.gameObject.activeSelf == true)
            {
                disk_factory.FreeDisk(disk_notshot[i]);
                disk_notshot.Remove(disk_notshot[i]);
                user_gui.ReduceBlood();
            }
        }
    }