示例#1
0
        void Start()
        {
            //PlayerPrefs.SetInt("Profit", 0);
            //PlayerPrefs.SetInt("AllScore",0);
            //PlayerPrefs.SetInt("GameCounter", 0);
            //PlayerPrefs.SetInt("BestScore", Random.Range(500,1000));
            audio       = gameObject.AddComponent <AudioSource>();
            profit      = PlayerPrefs.GetInt("Profit");
            bestScore   = PlayerPrefs.GetInt("BestScore");
            allScore    = PlayerPrefs.GetInt("AllScore");
            gameCounter = PlayerPrefs.GetInt("GameCounter");
            if (allScore < 1000)
            {
                allScore = 1000;
            }
            if (gameCounter < 10)
            {
                gameCounter = 10;
            }

            if (JavaInterface.Java())
            {
                if (bestScore < 500)
                {
                    bestScore = Random.Range(500, 1000);
                }

                playerText = Instantiate(texts[5]).GetComponent <CustomText>();
                playerText.transform.parent     = transform;
                playerText.transform.position   = new Vector3(-1.125f, 0.5f);
                playerText.transform.localScale = new Vector3(0.15f, 0.15f);

                scoreText = Instantiate(texts[7]).GetComponent <CustomText>();
                scoreText.transform.parent     = transform;
                scoreText.transform.position   = new Vector3(-1.125f, 0.40f);
                scoreText.transform.localScale = new Vector3(0.075f, 0.075f);
                //scoreText.Init();
                //scoreText.Display(0);
                //playerText.gameObject.SetActive(false);
            }
            else
            {
                mAuidoOption = Instantiate(audioOption).GetComponent <OptionAnimation>();
                mAuidoOption.transform.parent     = transform;
                mAuidoOption.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
                mAuidoOption.transform.position   = new Vector3(1.15f, 0.575f);

                //Debug.Log(mAuidoOption);
                EventListener.Get(mAuidoOption.gameObject).onClick += (GameObject obj) =>
                {
                    mAuidoOption.OnClick();
                };
                EventListener.Get(mAuidoOption.gameObject).onPress += (GameObject obj) =>
                {
                    mAuidoOption.OnPress();
                };
                EventListener.Get(mAuidoOption.gameObject).onFree += (GameObject obj) =>
                {
                    mAuidoOption.OnFree();
                };
            }
            mChopLeft  = Instantiate(chopLeft).GetComponent <ChopAnimation>();
            mChopRight = Instantiate(chopRight).GetComponent <ChopAnimation>();
            mChopLeft.transform.parent    = transform;
            mChopRight.transform.parent   = transform;
            mChopLeft.transform.position  = new Vector3(-0.75f, -0.125f);
            mChopRight.transform.position = new Vector3(0.75f, -0.125f);

            mChopLeft.Hide();
            mChopRight.Hide();



            gameText = Instantiate(texts[4]).GetComponent <CustomText>();
            gameText.transform.parent     = transform;
            gameText.transform.position   = new Vector3(0, 0.25f);
            gameText.transform.localScale = new Vector3(0.25f, 0.25f, 1);
            gameText.gameObject.SetActive(false);

            mMainPanel = Instantiate(mainPanel).GetComponent <PanelAnimation>();

            lastScoreText = Instantiate(texts[6]).GetComponent <CustomText>();
            lastScoreText.transform.parent     = mMainPanel.transform;
            lastScoreText.transform.localScale = new Vector3(0.1f, 0.2f);
            lastScoreText.transform.position   = mMainPanel.transform.position + new Vector3(0, -0.675f);

            bestText = Instantiate(texts[6]).GetComponent <CustomText>();
            bestText.transform.parent   = mMainPanel.transform;
            bestText.transform.position = mMainPanel.transform.position + new Vector3(0, -0.425f);
            bestText.Display(bestScore);

            mScroll = Instantiate(scroll).GetComponent <ScrollAnimation>();
            mScroll.transform.position = new Vector3(0, 0.65f);
            mScroll.transform.parent   = transform;
            mScroll.gameObject.SetActive(false);

            mScrollMain = Instantiate(scrollMain).GetComponent <ScrollAnimation>();
            mScrollMain.transform.position = new Vector3(1.2f, -0.15f);
            mScrollMain.transform.parent   = transform;

            mScrollMain.GetComponent <Renderer>().material.color = new Color(1, 1, 1, 0);
            for (int i = 0; i < mScrollMain.transform.childCount; i++)
            {
                mScrollMain.transform.GetChild(i).GetComponent <Renderer>().material.color = new Color(1, 1, 1, 0);
            }

            mAwards = mScrollMain.GetComponent <AwardsAnimation>();
            mScrollMain.gameObject.SetActive(false);

            if (JavaInterface.Java() == true)
            {
                mWelcome = Instantiate(welcomeArcade).GetComponent <WelcomeAnimation>();
            }
            else
            {
                mWelcome = Instantiate(welcomeMobile).GetComponent <WelcomeAnimation>();
            }
            mWelcome.transform.position = transform.position;
            mWelcome.transform.parent   = transform;
            //mWelcome.transform.localScale = new Vector3(2, 2);
            mWelcome.Hide();
            mWelcome.gameObject.GetComponent <Collider>().enabled = false;

            GameEvent.onGetScore    += OnGetScore;
            GameEvent.onDeath       += OnDeath;
            GameEvent.onFinishGame  += OnFinishGame;
            GameEvent.onReset       += OnReset;
            GameEvent.startReset    += StartReset;
            GameEvent.finishReset   += FinishReset;
            GameEvent.onHealth      += OnHealth;
            GameEvent.onStartGame   += OnStartGame;
            GameEvent.onWelcome     += OnWelcome;
            GameEvent.offWelcome    += OffWelcome;
            GameEvent.waitStartGame += WaitStartGame;
            GameEvent.onLaunchGame  += OnLaunchGame;

            EventListener.Get(mWelcome.gameObject).onClick += (GameObject obj) =>
            {
                GameController.isLaunchGame = true;
            };
            EventListener.Get(mChopLeft.gameObject).onPress += (GameObject obj) =>
            {
                GameController.isLaunchGame = true;
                GameEvent.OnAttackLeft(PlayerController.players[0]);
            };
            EventListener.Get(mChopRight.gameObject).onPress += (GameObject obj) =>
            {
                GameController.isLaunchGame = true;
                GameEvent.OnAttackRight(PlayerController.players[0]);
            };

            InputPort.onChangeScoreEvent += (int value) =>
            {
                playerText.Display(value / 10, 0.1f);
                scoreText.Display(value % 10, 0.1f);
            };
        }
示例#2
0
    void Start()
    {
        this.objects = MystObjectManager.Instance;
        // Debug.Log("called");

        WINDOW_TOP_LEFT      = new Vector2(0, 24);
        WINDOW_BOTTOM_RIGHT  = new Vector2(32, 0);
        AudioListener.volume = 0.05f;

        manager_state    = 10;
        GOBJ_MAIN_CAMERA = GameObject.Find("Main Camera");
        BLOOM            = GOBJ_MAIN_CAMERA.transform.FindChild("EffectCam").GetComponent <Bloom>();
        is_title_exit    = false;

        GOBJ_CANVAS        = GameObject.Find("Canvas");
        ANIM_TITLE         = GameObject.Find("Acters").GetComponent <Animator>();
        ANIM_TITLE.enabled = false;
        GOBJ_TITLE         = GOBJ_CANVAS.transform.FindChild("Title").gameObject;

        retry_count            = 0;
        GOBJ_RETRY_COUNT_OVER  = GOBJ_CANVAS.transform.FindChild("GameOver/RetryCount").gameObject;
        GOBJ_RETRY_COUNT_CLEAR = GOBJ_CANVAS.transform.FindChild("GameClear/RetryCount").gameObject;

        AUDIO_BGM      = GetComponent <AudioSource>();
        CLIP_BGM_TITLE = Resources.Load("BGM/そよぐ帳と夢の夢") as AudioClip;
        CLIP_BGM_MAIN  = Resources.Load("BGM/New_Gear") as AudioClip;
        AUDIO_BGM.clip = CLIP_BGM_TITLE;
        AUDIO_BGM.Play();

        PLAY_AREA          = new Vector2(32, 24);
        GOBJ_PLAYER        = GameObject.Find("MystPlayer");
        GOBJ_PLAYER_CHARGE = GOBJ_PLAYER.transform.FindChild("Charge").gameObject;
        GOBJ_PLAYER_CHARGE.SetActive(false);
        player_enable_controlle = true;
        PLAYER_MOVE_SPEED       = 8f;
        PLAYER_LAYER            = LayerMask.GetMask(new string[] { "Player" });
        PLAYER_LIFE_MAX         = 1;
        player_life             = PLAYER_LIFE_MAX;
        PLAYER_DAMAGE_PERIOD    = 1f;

        GOBJ_OPTIONS = GameObject.Find("Options");
        GOBJ_OPTIONS.SetActive(false);
        OPTIONS_ANIMATION     = GOBJ_OPTIONS.transform.FindChild("OptionImage/myst").GetComponent <OptionAnimation>();
        OPTIONS_MARGIN        = 2f;
        options_direction     = Vector2.right;
        OPTIONS_DIRECTION_SPD = 10f;
        option_state          = 0;
        isLockOptionPosition  = false;
        CHARGE_DURATION       = 1f;
        OPTIONS_SPD           = 70f;
        OPTIONS_BACK_SPD      = 60f;
        OPTIONS_LAYER         = LayerMask.GetMask(new string[] { "Bullet(Player)" });

        PRFB_LOCK_OPTION    = Resources.Load("Prefabs/Effects/LockEffect") as GameObject;
        PRFB_RELEASE_OPTION = Resources.Load("Prefabs/Effects/ReleaseEffect") as GameObject;
        PRFB_SHOT_OPTION    = Resources.Load("Prefabs/Effects/ChargeShotEffect") as GameObject;

        ENEMYS_LAYER = LayerMask.GetMask(new string[] { "Enemy", "EnemyFly", "EnemyBullet" });

        GOBJ_BOSS                = GameObject.Find("MystBoss");
        BOSS_ACTION              = new BossAction();
        BOSS_LIFE_MAX            = 15;
        boss_life                = BOSS_LIFE_MAX;
        GOBJ_BOSS_LIFE           = GameObject.Find("BossLife");
        BOSS_INITIAL_LIFE_HEIGHT = 1;
        BOSS_LIFE_HEIGHT_POINT   = BOSS_INITIAL_LIFE_HEIGHT / BOSS_LIFE_MAX;
        BOSS_DAMAGE_PERIOD       = 1f;

        PRFB_DAMAGE  = Resources.Load("Prefabs/Effects/Damage") as GameObject;
        PRFB_DESTROY = Resources.Load("Prefabs/Effects/Destroy") as GameObject;

        _HIGH_PASS_FILTER = GetComponent <AudioHighPassFilter>();

        #region Debug
        // StartCoroutine(InitializeOpenning());
        // GOBJ_CANVAS.SetActive(false);
        #endregion

        // ゲーム状態初期化用にGameStopを呼びたいが、タイトル画面にオプションが表示されちゃう
        this.GameStop();
        GOBJ_BOSS.transform.position = new Vector2(33f, 5.25f);
        GOBJ_BOSS_LIFE.SetActive(false);

        // GOBJ_OPTIONS.SetActive(false);
    }