Example #1
0
    public void SendDisk()
    {
        //从工厂生成一个飞碟
        GameObject disk = diskFactory.GetDisk(round);

        //设置飞碟的随机位置
        disk.transform.position = new Vector3(-disk.GetComponent <DiskData>().direction.x * 7, UnityEngine.Random.Range(0f, 8f), 0);
        disk.SetActive(true);
        //设置飞碟的飞行动作
        actionManager.Fly(disk, disk.GetComponent <DiskData>().speed, disk.GetComponent <DiskData>().direction);
    }
Example #2
0
    public void Shoot(Vector3 pos)
    {
        if (count < 20)
        {
            return;
        }
        count = 0;
        Debug.Log(pos);
        Quaternion rotations = Quaternion.identity;

        rotations.eulerAngles = new Vector3(90f, 0f, 0f);
        Vector3    start_pos  = new Vector3((Input.mousePosition.x - Screen.width / 2f) * 0.02f, (Input.mousePosition.y - Screen.height / 2f) * 0.02f, -10);
        GameObject ufo_object = Instantiate(Resources.Load <GameObject>("Prefabs/arrow"), start_pos, rotations);

        action_manager.Fly(ufo_object);
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (userGUI.mode == 0)
        {
            return;
        }
        if (userGUI.isKinematic == false)
        {
            actionManager = gameObject.GetComponent <PhysicActionManager>() as IActionManager;
        }
        else
        {
            actionManager = gameObject.GetComponent <CCActionManager>() as IActionManager;
        }
        GetHit();
        gameOver();
        if (round > max_round)
        {
            return;
        }

        timer -= Time.deltaTime;
        if (timer <= 0 && actionManager.RemainActionCount() == 0)
        {
            //if (timer <= 0) {
            //从工厂中得到10个飞碟,为其加上动作
            for (int i = 0; i < 10; ++i)
            {
                disk = factory.GetDisk(round);
                actionManager.Fly(disk);
                //Thread.Sleep(100);
            }
            round += 1;
            if (round <= max_round)
            {
                userGUI.round = round;
            }
            timer = 4.0f;
        }
    }