public void launchUFO()
    {
        int trailNum = scene.getTrailNum() > 3 ? 3 : scene.getTrailNum();

        Debug.Log("发射!");
        if (!UFOFactory.getInstance().isLaunching())
        {
            StartCoroutine(launchUFOs(trailNum));
        }
    }
    // Use this for initialization
    void Start()
    {
        sceneController = SceneController.GetInstance();
        actionManager   = ActionManager.GetInstance();
        ufoFactory      = UFOFactory.getInstance();

        actionManager = ActionManager.GetInstance();
        ufoFactory    = UFOFactory.getInstance();
        bulletFactory = BulletFactory.getInstance();
    }
示例#3
0
 IEnumerator launchUFOs(int roundNum)
 {
     for (int i = 0; i < roundNum; i++)
     {
         GameObject UFO = UFOFactory.getInstance().getUFO();
         UFO.transform.position = launcher.transform.position;
         UFO.GetComponent <MeshRenderer>().material = getMaterial(scene.getTrailNum());
         adapter.addForceOnUFO(UFO);
         yield return(new WaitForSeconds(LAUNCH_GAP));
     }
 }
示例#4
0
    IEnumerator launchUFOs(int roundNum)
    {
        for (int i = 0; i < roundNum; i++)
        {
            GameObject UFO = UFOFactory.getInstance().getUFO();
            UFO.transform.position = launcher.transform.position;
            UFO.GetComponent <MeshRenderer>().material = getMaterial(scene.getTrailNum());

            Vector3 force = getRandomForce();
            UFO.GetComponent <Rigidbody>().AddForce(force, ForceMode.Impulse);

            yield return(new WaitForSeconds(LAUNCH_GAP));
        }
    }
    public void hitUFO(Vector3 mousePos)
    {
        Ray        ray = Camera.main.ScreenPointToRay(mousePos);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.collider.gameObject.tag.Equals("UFO"))
            {
                createExplosion(hit.collider.gameObject.transform.position);
                scene.addScore();
                UFOFactory.getInstance().RecyclingUFO(hit.collider.gameObject);
            }
        }
    }
示例#6
0
 public void GameOver()
 {
     CancelInvoke("CreateUFO");
     CancelInvoke("DisplayNum");
     for (int i = 0; i < UFOFactory.getInstance().usingUFO.Count; i++)
     {
         DestroyObject(UFOFactory.getInstance().usingUFO [i]);
     }
     for (int i = 0; i < UFOFactory.getInstance().usingUFO.Count; i++)
     {
         UFOFactory.getInstance().usingUFO.RemoveAt(i);
     }
     for (int j = 0; j < ExplosionList.Count; j++)
     {
         DestroyObject(ExplosionList [j]);
     }
     for (int j = 0; j < ExplosionList.Count; j++)
     {
         ExplosionList.RemoveAt(j);
     }
     Director.getInstance().game_state = GameState.DISPLAY_SCORE;
     this.DisplayScore();
 }
示例#7
0
 void Start()
 {
     ufoFactory    = UFOFactory.getInstance();
     bulletFactory = BulletFactory.getInstance();
 }
示例#8
0
 private void Awake()
 {
     UFOFactory.getInstance().initItems(ufoItem);
 }
 // Update is called once per frame
 void Update()
 {
     UFOFactory.getInstance().detectLandingUFOs();
 }
示例#10
0
 private void OnMouseDown()
 {
     UFOFactory.getInstance().releaseUFO(gameObject, true);
     Director.getInstance().score += 2;
 }
示例#11
0
 public void CreateUFO()
 {
     UFOFactory.getInstance().getNewUFO();
 }