Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     cycleTimer       = 0;
     max_speed        = Mathf.Exp(1);
     player           = GameObject.FindGameObjectWithTag("Player").transform;
     playerMoveScript = player.GetComponent <Player_move>();
 }
Exemplo n.º 2
0
    void OnGUI()
    {
        if (!start){
            GUI.Box (new Rect (UnityEngine.Screen.width/2-startBoxWidth/2,UnityEngine.Screen.height/2-startBoxHeight/2,startBoxWidth,startBoxHeight), startContent, guistyle );
            if(GUI.Button (new Rect (UnityEngine.Screen.width/2-UnityEngine.Screen.width/10/2,UnityEngine.Screen.height/2-UnityEngine.Screen.height/10/2+UnityEngine.Screen.height/5,UnityEngine.Screen.width/10,UnityEngine.Screen.height/10), "Start")){
                Transform newPlayer = Instantiate(player, transform.position, Quaternion.identity) as Transform;
                playerscript = newPlayer.GetComponent<Player_move>();
                Transform spawn = Instantiate(spawner, spawnerLocation, Quaternion.identity) as Transform;
                timeAtStart = Time.timeSinceLevelLoad;
                spawn.GetComponent<Enemy_spawn>().timeAtStart = timeAtStart;
                start = true;
            }
        }
        if (playerscript.playerDead){
            if(GUI.Button (new Rect (UnityEngine.Screen.width/2-UnityEngine.Screen.width/10/2-100,UnityEngine.Screen.height/2-UnityEngine.Screen.height/10/2+UnityEngine.Screen.height/5,UnityEngine.Screen.width/10,UnityEngine.Screen.height/10), "Quit")){
                //BACK TO MAIN MENU HERE
                Application.LoadLevel("menu");

            }
            if(GUI.Button (new Rect (UnityEngine.Screen.width/2-UnityEngine.Screen.width/10/2+100,UnityEngine.Screen.height/2-UnityEngine.Screen.height/10/2+UnityEngine.Screen.height/5,UnityEngine.Screen.width/10,UnityEngine.Screen.height/10), "Restart")){
                //Restart Game
                Application.LoadLevel("fire");
            }

        }
    }
Exemplo n.º 3
0
 void OnGUI()
 {
     if (!start)
     {
         GUI.Box(new Rect(UnityEngine.Screen.width / 2 - startBoxWidth / 2, UnityEngine.Screen.height / 2 - startBoxHeight / 2, startBoxWidth, startBoxHeight), startContent, guistyle);
         if (GUI.Button(new Rect(UnityEngine.Screen.width / 2 - UnityEngine.Screen.width / 10 / 2, UnityEngine.Screen.height / 2 - UnityEngine.Screen.height / 10 / 2 + UnityEngine.Screen.height / 5, UnityEngine.Screen.width / 10, UnityEngine.Screen.height / 10), "Start"))
         {
             Transform newPlayer = Instantiate(player, transform.position, Quaternion.identity) as Transform;
             playerscript = newPlayer.GetComponent <Player_move>();
             Transform spawn = Instantiate(spawner, spawnerLocation, Quaternion.identity) as Transform;
             timeAtStart = Time.timeSinceLevelLoad;
             spawn.GetComponent <Enemy_spawn>().timeAtStart = timeAtStart;
             start = true;
         }
     }
     if (playerscript.playerDead)
     {
         if (GUI.Button(new Rect(UnityEngine.Screen.width / 2 - UnityEngine.Screen.width / 10 / 2 - 100, UnityEngine.Screen.height / 2 - UnityEngine.Screen.height / 10 / 2 + UnityEngine.Screen.height / 5, UnityEngine.Screen.width / 10, UnityEngine.Screen.height / 10), "Quit"))
         {
             //BACK TO MAIN MENU HERE
             Application.LoadLevel("menu");
         }
         if (GUI.Button(new Rect(UnityEngine.Screen.width / 2 - UnityEngine.Screen.width / 10 / 2 + 100, UnityEngine.Screen.height / 2 - UnityEngine.Screen.height / 10 / 2 + UnityEngine.Screen.height / 5, UnityEngine.Screen.width / 10, UnityEngine.Screen.height / 10), "Restart"))
         {
             //Restart Game
             Application.LoadLevel("fire");
         }
     }
 }
Exemplo n.º 4
0
 void Start()
 {
     CountSourse               = this.GetComponent <AudioSource>();
     freeze_p                  = player.gameObject.GetComponent <Player_move>();
     freeze_s                  = stamina.gameObject.GetComponent <StaminaBar>();
     _textCountdown.text       = "";
     _textCountdown_third.text = "";
 }
Exemplo n.º 5
0
 void Start()
 {
     //p_point_max = Player_move.P_SP
     player_object         = GameObject.Find("Player");
     player_script         = player_object.GetComponent <Player_move>();
     sp_gage_scale_orign_x = transform.localScale.x;
     sp_gage_scale_orign_y = transform.localScale.y;
     sp_one_mater_x        = sp_gage_scale_orign_x / Player_move.P_HP;
 }
Exemplo n.º 6
0
    /*private void OnBecameInvisible()
     * {
     *  //もしも画面から消えたらっていう便利関数
     *  pbullet_destroy();  //自機を消す
     * }*/

    void pbullet_destroy()
    {
        Destroy(gameObject);
        pobj = GameObject.Find("Player");   //プレイヤーのオブジェクトを見つける

        //プレーヤーのSPを回復
        Player_move p_script = pobj.GetComponent <Player_move>();

        p_script.p_sp++;
    }
Exemplo n.º 7
0
    void Start()
    {
        AudioListener.volume = 1;

        isStart                   = false;
        CountSourse               = this.GetComponent <AudioSource>();
        freeze_p                  = player.gameObject.GetComponent <Player_move>();
        freeze_s                  = stamina.gameObject.GetComponent <StaminaBar>();
        _textCountdown.text       = "";
        _textCountdown_third.text = "";
        StartCoroutine(CountdownCoroutine());
        Is_Coroutine_flag = true;
    }
Exemplo n.º 8
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        // 接触した瞬間の1回のみ呼び出される処理
        if (collision.gameObject.name == "Enemy(Clone)")
        {
            GameObject eobj     = GameObject.Find("Enemy(Clone)");
            Enemy_move e_script = eobj.GetComponent <Enemy_move>();
            e_script.enemy_destroy(true); //敵を消す

            pbullet_destroy();            //自機を消す

            pobj = GameObject.Find("Player");
            Player_move p_script = pobj.GetComponent <Player_move>();
            p_script.p_attack++;
        }
    }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        game_state    = PLAYING;
        player_obj    = GameObject.Find("Player");
        player_script = player_obj.GetComponent <Player_move>();

        /*Vector3 hp_prefab_position = new Vector3( -480, 380, 0 );
         * Vector3 sp_prefab_position = new Vector3(-480, 280, 0);
         *
         * Instantiate(hp_prefab, hp_prefab_position, Quaternion.identity);
         * hp_gage_script = hp_prefab.GetComponent<Sp_gage_control>();
         * hp_gage_script.p_point = player_script.p_hp;
         * hp_gage_script.p_point_max = Player_move.P_HP;
         *
         * Instantiate(sp_prefab, sp_prefab_position, Quaternion.identity);
         * sp_gage_script = sp_prefab.GetComponent<Sp_gage_control>();
         * sp_gage_script.p_point = player_script.p_sp;
         * sp_gage_script.p_point_max = Player_move.P_SP;*/
    }
Exemplo n.º 10
0
    void play_display()
    {
        player_script = player_obj.GetComponent <Player_move>();

        // オブジェクトからTextコンポーネントを取得
        Text text_attack_dis   = text_attack.GetComponent <Text>();
        Text text_hp_dis       = text_hp.GetComponent <Text>();
        Text text_gameover_dis = text_gameover.GetComponent <Text>();
        Text text_presskey_dis = text_presskey.GetComponent <Text>();
        Text text_sp_dis       = text_sp.GetComponent <Text>();

        // テキストの表示を入れ替える
        text_attack_dis.text   = "撃破:" + player_script.p_attack;
        text_hp_dis.text       = "残機:" + player_script.p_hp;
        text_gameover_dis.text = " ";
        text_presskey_dis.text = " ";
        text_sp_dis.text       = "弾数:" + player_script.p_sp;

        /*hp_gage_script.p_point = player_script.p_hp;
        *  sp_gage_script.p_point = player_script.p_sp;*/
    }
Exemplo n.º 11
0
 void Start()
 {
     playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<Player_move>();
 }
Exemplo n.º 12
0
 void Start()
 {
     player_move_s = GetComponent <Player_move>();
 }
Exemplo n.º 13
0
 void Start()
 {
     playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_move>();
 }
Exemplo n.º 14
0
    public void mapSpawn()
    {
        TextAsset    data = Resources.Load(stageData, typeof(TextAsset)) as TextAsset;      // Read Mapdata
        StringReader sr   = new StringReader(data.text);

        mapLine = 0;

        string oneLine = sr.ReadLine();         // Read oneLine

        while (oneLine != null)
        {
            string[] mapData = oneLine.Split('\t');

            for (int idx = 0; idx < mapData.Length; idx++)
            {
                switch (mapData [idx])
                {
                case "0":
                    Instantiate(prefab_Dirt, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "1":
                    Instantiate(prefab_Ground, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "2":
                    Instantiate(prefab_WaterDeep, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "3":
                    Instantiate(prefab_Water, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "4":
                    Instantiate(prefab_Lotus, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "41":
                    Instantiate(prefab_LottenLotus, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "42":
                    Instantiate(prefab_Fix_Lotus, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "43":
                    Instantiate(prefab_Fix_LottenLotus, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "5":
                    Instantiate(prefab_Frog, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "6":
                    Instantiate(prefab_Friend, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "7":
                    Player.transform.position = new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize));
                    Player_move pl = GameObject.Find("Player").GetComponent <Player_move> ();
                    GameObject.Find("Main Camera").SendMessage("setCameraPosition");                       // Player Reset
                    pl.defaultPos = Player.transform.position;
                    break;

                case "8":
                    Instantiate(prefab_Portal, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "9":
                    Instantiate(prefab_Wall, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "10":
                    Instantiate(prefab_InnerDirt, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "11":
                    Instantiate(prefab_InnerGround, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "12":
                    Instantiate(prefab_Mushroom, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "15":
                    Instantiate(prefab_Trap_Tree, new Vector2(mapLine * tileSize - 28.24f, 12.92f - ((idx + 1) * tileSize)), Quaternion.identity);
                    break;

                case "19":
                    Instantiate(prefab_Trap_DropSpike, new Vector2(mapLine * tileSize - 28.24f, 12.92f - ((idx) * tileSize)), Quaternion.identity);
                    break;

                case "20":
                    Instantiate(prefab_Trap_Spike1, new Vector2(mapLine * tileSize - 28.24f, 12.92f - ((idx) * tileSize)), Quaternion.identity);
                    break;

                case "201":
                    Instantiate(prefab_Trap_Spike2, new Vector2(mapLine * tileSize - 28.24f, 12.92f - ((idx) * tileSize)), Quaternion.identity);
                    break;

                case "77":
                    Instantiate(prefab_End, new Vector2(mapLine * tileSize - 28.24f, 12.92f - ((idx) * tileSize)), Quaternion.identity);
                    break;
                }
            }
            for (int idx = mapData.Length; idx < mapData.Length + 6; idx++)
            {
                switch (mapData [mapData.Length - 1])
                {
                case "0":
                case "1":
                case "20":
                    Instantiate(prefab_Dirt, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "2":
                case "3":
                    Instantiate(prefab_WaterDeep, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;

                case "10":
                case "11":
                case "201":
                    Instantiate(prefab_InnerDirt, new Vector2(mapLine * tileSize - 28.24f, 12.92f - (idx * tileSize)), Quaternion.identity);
                    break;
                }
            }
            mapLine++;
            oneLine = sr.ReadLine();
        }
    }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     cycleTimer = 0;
     max_speed=Mathf.Exp (1);
     player = GameObject.FindGameObjectWithTag("Player").transform;
     playerMoveScript = player.GetComponent<Player_move>();
 }