Ejemplo n.º 1
0
    void PressLogin(GameObject _obj)
    {
        //销毁UI
        Destroy(gameObject);

        //加载Game UI
        UIScene_Game ui_game = BasePlayer.UIMgr.UI <UIScene_Game>();

        #region 做了三个发射器
        float height = Camera.main.orthographicSize / 2f;
        //启动发射器
        for (int i = 0; i < 3; i++)
        {
            Vector3 pos = new Vector3(
                Camera.main.transform.position.x,
                (Camera.main.transform.position.y + Camera.main.orthographicSize - (i + 1) * (height)),
                0f
                );

            GameObject obj = Instantiate(Resources.Load("Controller/MonsterLauncher")) as GameObject;
            obj.transform.position = pos;
            MonsterLauncher ml = obj.GetComponent <MonsterLauncher>();
            ml.OnStart(ui_game);
        }
        #endregion

        //播放声音
        AudioManager.PlayAudio(null, eAudioType.Audio_BackGround, "BackGround", 1, true);

        //加载刀片
        KnifeController.CreateKnife();
    }
Ejemplo n.º 2
0
    public void OnStart()
    {
        GlobalHelper.SetBackImg("background");

        //加载垃圾回收站
        GlobalHelper.LoadGarbageCollection();

        //摆放launcher的位置
        float   y = GlobalHelper.GetVisibleYPos(transform.position.z, MaxSize);
        Vector3 v = transform.position;

        transform.position = new Vector3(v.x, y, v.z);

        //生成水果
        InvokeRepeating("InstantiateFruites", 0.8f, 0.7f);

        //加载刀片
        m_kc = KnifeController.InstantiateMyKnife(v.z);

        //加载uiscene_game
        Transform ui = GlobalHelper.OpenUISceneByName("UIScene_Game");

        m_uigame = ui.GetComponent <UIScene_Game>();
        m_uigame.RegisterSliceMissle(this);
    }
Ejemplo n.º 3
0
    public void OnStart(UIScene_Game _game)
    {
        float width = Camera.main.orthographicSize * Camera.main.aspect;

        //设置怪物的位置
        transform.position = new Vector3(Camera.main.transform.position.x + width + 2, transform.position.y, 0f);

        StartCoroutine(GeneratingMonster(_game));
        //MonsterActorV1.CreateMonster(eMonsterType.Cactus1, transform.position, transform.rotation);
    }
Ejemplo n.º 4
0
 IEnumerator GeneratingMonster(UIScene_Game _game)
 {
     while (true)
     {
         float        n    = Random.Range(4f, 7f);
         int          m    = Random.Range(1, (int)(eMonsterType.Monster_Size + 1));
         eMonsterType type = (eMonsterType)m;
         MonsterActorV1.CreateMonster(type, transform.position, transform.rotation, _game.HitMonster, _game.MissMonster, m_eType);
         yield return(new WaitForSeconds(n));
     }
 }