Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    //UpdateScore()
    public void PlayerScore()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <Game_Manager>();

        playerScore += 10;
        playerScoreText.GetComponent <Text>().text = playerScore.ToString();
    }
Ejemplo n.º 2
0
    public void Event_Init()
    {
        str_ride_car = ride_car.Instance;
        str_char     = Character.Instance;
        str_Game_mag = Game_Manager.Instance;
        str_camera   = Camera_Manager.Instance;

        //1회만 셋팅.
        dir_p_set = false;
        steel_on  = false;

        //충돌 차량 관련 변수
        car_speed  = 6.0f;
        dump_speed = 10.0f;
        car_attack = false;
        dump_on    = false;
        car_dis    = .0f;
        car_dir    = new Vector3(0, 0, 0);
        car_roll   = 20.0f;

        dis_steel_       = .0f;
        dir_steel_       = new Vector3(0, 0, 0);
        steel_attack     = false;
        steel_down_speed = 5.0f;

        //파편과 파편방향 초기화.
        for (int i = 0; i < 4; i++)
        {
            player_p[i].GetComponent <Renderer>().enabled = false;

            player_p[i].transform.position     = str_char.transform.position;
            player_p_dir[i].transform.position = str_char.transform.position;
        }
    }
Ejemplo n.º 3
0
 //タッチされたときに呼ぶメソッド
 public void EventTouch()
 {
     text = getimage.transform.GetChild(0).GetComponent <Text>();
     gm   = gamemanager.GetComponent <Game_Manager>();
     //Debug.Log(this.gameObject.name + "ENENTTOUCH");
     Get_Collection_Process();
 }
Ejemplo n.º 4
0
    private void Awake()
    {
        //コンポーネントの取得
        GM             = this.GetComponent <Game_Manager>();
        MA             = this.GetComponent <Mino_ArrayAssistant>();
        Mino_operation = this.GetComponent <Mino_KeyInput>();
        Mino_create    = this.GetComponent <Mino_Create>();
        Mino_move      = this.GetComponent <Mino_Move>();
        Mino_moveghost = this.GetComponent <Mino_MoveGhost>();
        Mino_rotation  = this.GetComponent <Mino_Rotation>();
        Mino_hold      = this.GetComponent <Mino_Hold>();
        Dbgcode        = this.GetComponent <Mino_DebugCode>();
        audioSource    = this.GetComponent <AudioSource>();
        //初期設定
        Mino            = new MINOs_Array(0, new int[MINOSIZE, MINOSIZE], new GameObject[4], new GameObject[4]);
        MINO            = (GameObject)Resources.Load("Prefabs/MINO");
        MINOs           = Instantiate(MINO, MINO.transform.position, Quaternion.identity);
        GHOSTMINOs      = Instantiate(MINO, MINO.transform.position, Quaternion.identity);
        GHOSTMINOs.name = ("GHOSTMINOs");
        NowColorObj     = (GameObject)Resources.Load("Prefabs/MINO_I");

        //UseMinoGhost配列の初期設定
        for (int i = 0; i < Mino.UseMinoGhost.Length; i++)
        {
            Mino.UseMinoGhost[i] = Instantiate(NowColorObj, MINOs.transform.position, Quaternion.identity, GHOSTMINOs.transform);
        }
    }
Ejemplo n.º 5
0
 void OnTriggerEnter(Collider col)
 {
     if (Game_Manager.Instance().getGreenActive() == true)
     {
         Game_Manager.Instance().getPlayer().GetComponent <Character_Ctrl>().RemoveHealth(damage);
     }
 }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        currentscore      = Game_Manager.Instance().getPlayer().GetComponent <Character_Ctrl>().GetDiceAmount();
        _currentText.text = "X" + currentscore;
        _HealthBar.value  = Game_Manager.Instance().getPlayer().GetComponent <Character_Ctrl>().GetHealth();
        if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown("joystick button 7"))
        {
            _Paused = !_Paused;
        }
        if (_Paused)
        {
            Time.timeScale = 0;
            _PauseMenu.SetActive(true);
        }
        else
        {
            _PauseMenu.SetActive(false);
            Time.timeScale = 1;
        }


        _NoRedGem.SetActive(Game_Manager.Instance().getRedActive());
        _NoBlueGem.SetActive(Game_Manager.Instance().getBlueActive());
        _NoGreenGem.SetActive(Game_Manager.Instance().getGreenActive());
        _NoPurpleGem.SetActive(Game_Manager.Instance().getPurpleActive());
    }
    public void Awake()
    {
        #region
        btnRestart.SetActive(false);
        btnLeaveGame.SetActive(false);
        txtWaitingForOtherPlayers.SetActive(true);
        btnScore.SetActive(false);
        btnAccessNewTrack.SetActive(false);

        gManager = GameObject.Find("Game_Manager").GetComponent <Game_Manager>();

        GameObject tmpObj = GameObject.Find("GM_Photon");
        if (tmpObj)
        {
            PhotonManager = tmpObj.GetComponent <MCR.GameManager_MCR_Photon>();
        }

        tmpObj = GameObject.Find("EventSystem");
        if (tmpObj)
        {
            eventSystem = tmpObj.GetComponent <EventSystem>();
        }

        #endregion
    }
 void Start()
 {
     AM    = GetComponent <Animator>();
     speed = StandardSpeed;
     rb    = GetComponent <Rigidbody2D>();
     GM    = GameObject.FindGameObjectWithTag("Game_Manager").GetComponent <Game_Manager>();
 }
Ejemplo n.º 9
0
    void Start()
    {
        currentHP = maxHP;
        GameObject gObj = GameObject.Find("GameplayCanvas");

        gameManager         = GameObject.FindObjectOfType <Game_Manager>();
        sliderHealthBar     = gObj.GetComponentInChildren <Slider>();
        sliderHealthBarAnim = gObj.GetComponentInChildren <Animator>();
        Image[] imgs = gObj.GetComponentsInChildren <Image>(true);
        for (int i = 0; i < imgs.Length; i++)
        {
            if (imgs[i].name == "BloodScreen")
            {
                bloodyScreen = imgs[i];
                continue;
            }
            if (imgs[i].name == "DamageScreen")
            {
                damageScreen = imgs[i];
                damageScreen.gameObject.SetActive(false);
                continue;
            }
        }

        sliderHealthBar.maxValue = maxHP;
        UpdateHealthBar();
    }
    public bool isTeleporting = false;     // Currently teleporting (to block movement etc)


    // Use this for initialization
    void Start()
    {
        if ((movementHandler = GetComponent <Player_Movement>()) == null)
        {
            Debug.LogError("You need to add a player movement script to this game object");
        }

        if ((animationHandler = GetComponent <Player_Animation_Controller>()) == null)
        {
            Debug.LogError("You need to add a player animation handler script to this game object");
        }

        if ((manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <Game_Manager>()) == null)
        {
            Debug.LogError("You're missing a Game Manager with a game manager script in your scene");
        }

        if ((inventoryHandler = GetComponent <Player_Inventory>()) == null)
        {
            Debug.LogError("You need to add a player inventory script to this game object");
        }

        if ((GameObject.FindGameObjectWithTag("Hand") == null))
        {
            Debug.LogError("You need to add a hand tag to a part of the player body (weapon pickup)");
        }

        height = GetComponent <MeshRenderer> ().bounds.size.y;
        state  = PLAYER_STATE.ALIVE;

        transform.position = determineRespawnPos(spawnPos.position, 15);
    }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_attack_health>();
     boss   = GameObject.FindGameObjectWithTag("Boss").GetComponent <Boss>();
     gm     = GameObject.FindGameObjectWithTag("Game_Manager").GetComponent <Game_Manager>();
     damage = boss.damage;
 }
Ejemplo n.º 12
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            DestroyImmediate(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        if (Application.isEditor)
        {
            isPC = true;
        }
        else if (Application.isMobilePlatform)
        {
            isPC = false;

            Application.targetFrameRate = 60;

            Debug.Log("Is Mobile");
        }
        else
        {
            isPC = true;

            Debug.Log("Is PC");
        }
    }
Ejemplo n.º 13
0
 // Start is called before the first frame update
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
 }
Ejemplo n.º 14
0
    // Update is called once per frame
    void Update()
    {
        if (Game_Manager.Instance().GetTreasurebool() == true)
        {
            _gateUp = true;
        }
        if (_gateUp == false)
        {
            Timer = 0;
            if (_Gate.transform.localPosition.z > startPos.z)
            {
                _Gate.transform.Translate(new Vector3(0, 0, -Time.deltaTime * MovSpeed));
            }
        }
        else
        {
            if (Game_Manager.Instance().GetTreasurebool() == false)
            {
                Timer += Time.deltaTime;
            }



            if (_Gate.transform.localPosition.z <= EndPos.localPosition.z)
            {
                _Gate.transform.Translate(new Vector3(0, 0, Time.deltaTime * MovSpeed));
            }
            if (Timer >= 10)
            {
                _gateUp = false;
            }
        }
    }
Ejemplo n.º 15
0
    void getBallStartPosition()
    {
        GameObject   gm        = GameObject.Find("Game_Manager");
        Game_Manager tempGMVar = gm.GetComponent <Game_Manager>();

        transform.position = tempGMVar.ballStartPosition;
    }
Ejemplo n.º 16
0
 //sets stats and defines some stuff
 private void Start()
 {
     Current_Health = Max_Health;
     Seen_By        = 0;
     Game_Manager   = GameObject.FindWithTag("Game_Manager");
     gm             = Game_Manager.GetComponent <Game_Manager>();
 }
Ejemplo n.º 17
0
    public int level = 5;                                  //Current level number, expressed in game as "Day 1".

    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Get a component reference to the attached BoardManager script
        //  boardScript = GetComponent<BoardManager>();

        //Call the InitGame function to initialize the first level
        InitGame();
    }
Ejemplo n.º 18
0
 // Game Manager, Collider2D 를 캐싱
 protected void Awake()
 {
     manager  = GameObject.FindWithTag("Manager").GetComponent <Game_Manager>();
     canvas   = GameObject.FindWithTag("Canvas").GetComponent <UiManager>();
     save     = GameObject.FindWithTag("Manager").GetComponent <GameSave>();
     collider = GetComponent <Collider2D>();
 }
Ejemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     nav          = this.GetComponent <SteeringFollowNavMeshPath>();
     Game_Manager = GameObject.Find("Game_Manager").GetComponent <Game_Manager>();
     Check_Cells();
     audio_sim = this.GetComponent <AudioSource>();
 }
Ejemplo n.º 20
0
    public void startGame()
    {
        GameManager = GameObject.Find("GameManager");
        _GM         = GameManager.gameObject.GetComponent(typeof(Game_Manager)) as Game_Manager;

        Debug.Log("log me");

        _GM.set_PlayerName(Pname.text);
        Debug.Log(_GM.get_PlayerName());

        if (mark1.isOn == true)
        {
            Debug.Log("Choice is 1");
            _GM.set_StartChoice(1);
            _GM.set_GameState("start");
            SceneManager.LoadScene(2);
        }
        else
        {
            Debug.Log("Choice is 2");
            _GM.set_StartChoice(2);
            _GM.set_GameState("start");
            SceneManager.LoadScene(2);
        }
    }
Ejemplo n.º 21
0
    // Update is called once per frame
    void Update()
    {
        if (folkparken)
        {
            if (player == null)
            {
                player       = GameObject.FindWithTag("Player");
                playerScript = player.GetComponent <Player_Controller>();
                Debug.Log("Player found!");
            }
            if (manager == null)
            {
                manager       = GameObject.Find("Game Manager");
                managerScript = manager.GetComponent <Game_Manager>();
                Debug.Log("Manager found!");
            }


            if (playerScript.health <= 0)
            {
                healthText.text = "Oj oj";
            }
            else
            {
                healthText.text = "x " + playerScript.health.ToString();
            }

            scoreText.text = "SCORE: " + PlayerStats.Score.ToString();

            timeText.text = "TIME: " + managerScript.gameTime.ToString("0");
        }
    }
Ejemplo n.º 22
0
    void Start()
    {
        // 플레이어,게임매니저 및 기타 컴포넌트 참조
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_attack_health>();
        gm     = GameObject.FindGameObjectWithTag("Game_Manager").GetComponent <Game_Manager>();

        if (!rend)
        {
            rend = GetComponent <SpriteRenderer>();
        }
        if (!rb)
        {
            rb = GetComponent <Rigidbody2D>();
        }

        // 최대체력,공격력 초기화
        max_health     = 100 + 20000 * gm.stage_level;
        current_health = max_health;
        damage         = 10 + 100 * gm.stage_level;

        hp_slider.value     = current_health / max_health;
        health_text.text    = string.Format("{0}/{1}", Mathf.Floor(current_health), Mathf.Floor(max_health));
        damage_ui_text.text = string.Format("보스 공격력 : {0}  방어력 : {1}%", damage, gm.stage_level);

        StartCoroutine(Color_change()); // 일정시간마다 보스몬스터의 색상 상태 변경

        // 4가지의 공격패턴을 각각 설정된 시간마다 사용
        StartCoroutine(Attack1());
        StartCoroutine(Attack2());
        StartCoroutine(Attack3());
        StartCoroutine(Attack4());
    }
Ejemplo n.º 23
0
    //*!----------------------------!*//
    //*!    Unity Functions
    //*!----------------------------!*//
    #region Unity Functions

    /// <summary>
    /// Set room bounds and a reference to the game manager
    /// </summary>
    private void Start()
    {
        game_manager = GameObject.FindGameObjectWithTag("GameController").GetComponent <Game_Manager>();

        //*! Set the bounds for Room One
        #region Room one area

        room_one.bounds_min.x = -5;
        room_one.bounds_max.x = 5;

        room_one.bounds_min.y = -8;
        room_one.bounds_max.y = 2;

        #endregion

        //*! Set the bounds for Room Two
        #region Room one area

        room_two.bounds_min.x = -5;
        room_two.bounds_max.x = 5;

        room_two.bounds_min.y = -8;
        room_two.bounds_max.y = 15;

        #endregion
    }
Ejemplo n.º 24
0
    void Update()
    {
        offset    = Game_Manager.Map(cam.orthographicSize, pinch.minZoom, pinch.maxZoom, minOff, maxOff);
        topStartY = top.transform.position.y;

        belowPopUp = new Vector3(abovePopUp.x, abovePopUp.y - offset, abovePopUp.z);

        if (loadScene)
        {
            if (Vector2.Distance(transform.position, player.transform.position) < 1f)
            {
                Game_Manager.SavePlayerPos(transform.position);
                transform.GetComponent <Site_Info>().LoadCorrespondingScene();
            }
        }

        if (showing)
        {
            Vector3 topScreen = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth / 2, cam.pixelHeight, 0));

            float topScreenY = topScreen.y + Game_Manager.Map(offset, minOff, maxOff, 5f, 45f);


            if (topStartY > topScreenY)
            {
                popUp.transform.position = belowPopUp;
            }
            else
            {
                popUp.transform.position = abovePopUp;
            }
        }
    }
Ejemplo n.º 25
0
 void SetCarValue(Game_Manager myScript, int difficulty,
                  float speedBoose1, int followCircuit1, int OptimizedSpeed1, int OptimizedCarRotation1,
                  float speedBoose2, int followCircuit2, int OptimizedSpeed2, int OptimizedCarRotation2,
                  float speedBoose3, int followCircuit3, int OptimizedSpeed3, int OptimizedCarRotation3)
 {
     if (difficulty == 0)
     {
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].addGlobalSpeedOffset.Add(speedBoose1);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].waypointSuccesRate.Add(followCircuit1);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].rotationSuccesRate.Add(OptimizedSpeed1);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].speedSuccesRate.Add(OptimizedCarRotation1);
     }
     else if (difficulty == 1)
     {
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].addGlobalSpeedOffset.Add(speedBoose2);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].waypointSuccesRate.Add(followCircuit2);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].rotationSuccesRate.Add(OptimizedSpeed2);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].speedSuccesRate.Add(OptimizedCarRotation2);
     }
     else
     {
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].addGlobalSpeedOffset.Add(speedBoose3);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].waypointSuccesRate.Add(followCircuit3);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].rotationSuccesRate.Add(OptimizedSpeed3);
         myScript.gameObject.GetComponent <DifficultyManager>().difficulties[difficulty].speedSuccesRate.Add(OptimizedCarRotation3);
     }
 }
Ejemplo n.º 26
0
    void Start()
    {
        m_NormalSpeed = m_Speed;
        _TakeMedicine = false;
        if (m_Game_Manager == null)
        {
            m_Game_Manager = FindObjectOfType <Game_Manager> ();
        }

        if (m_BoxCollider2D == null)
        {
            m_BoxCollider2D = GetComponent <BoxCollider2D> ();
        }
        if (m_Rigidbody2D == null)
        {
            m_Rigidbody2D = GetComponent <Rigidbody2D> ();
        }

        if (anim_Player == null)
        {
            anim_Player = GetComponentInChildren <Animator> ();
        }

        //  Rigidbody2D Setting -- if Game Start -- For Team
        m_Rigidbody2D.bodyType       = RigidbodyType2D.Dynamic;
        m_Rigidbody2D.gravityScale   = 0;
        m_Rigidbody2D.freezeRotation = true;
    }
Ejemplo n.º 27
0
    void Awake()
    {
        IsPaused = false;
        instance = this;

        BestScore = PlayerPrefs.GetInt("BestScore");
    }
Ejemplo n.º 28
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Player")
     {
         Game_Manager.Instance().getPlayer().GetComponent <Character_Ctrl>().RemoveHealth(100);
     }
 }
Ejemplo n.º 29
0
    private GameObject target;  // USED TO SET THE TARGET FOR THR ENEMY

    private void Start()
    {
        gm     = GameObject.Find("Game_Manager").GetComponent <Game_Manager>();              // USED TIO FIND THE GAME MANAGER AND ACCESS THE GAMEMANAGER SCRIPT
        plM    = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Manager>(); // USED TIO FIND THE PLAYER GAMEOBJECT AND ACCESS THE PLAYERMANAGER SCRIPT
        target = GameObject.FindGameObjectWithTag("Player");                                 // SETS THE TARGET TO THE GAMEOBJECT WITH THE TAG PLAYER
        speed  = 3;                                                                          // SETS THE SPEED OF THE ENEMY AI TO 3
    }
Ejemplo n.º 30
0
 private void Start()
 {
     Instance         = this;
     foundationObject = GameObject.Find("Foundation");
     blockOffset      = (Vector3.one * 0.5f) / 4;
     selectedColor    = BlockColor.White;
 }
Ejemplo n.º 31
0
 void Start()
 {
     Player = GameObject.FindWithTag ("Player");
     CheckScript = Player.GetComponent<Game_Manager> ();
     CheckIMAGE = gameObject.GetComponent <SpriteRenderer> ();
     checkpointPOS = Player.transform.position;
     CheckList = CheckScript.CheckList;
 }
Ejemplo n.º 32
0
    void Start()
    {
        GameObject a = GameObject.Find("05_GameManager");
        if(a!=null)_gm = a.GetComponent<Game_Manager>();

        GameObject b = GameObject.Find("Black_Screen");
        if(b!=null)_fade = b.GetComponent<Fade>();
    }
Ejemplo n.º 33
0
    void Awake()
    {
        if(Instance != null && Instance != this){
            Destroy(gameObject);
        }

        Instance = this;

        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 34
0
 // Use this for initialization
 void Start()
 {
     Timer = GameObject.Find ("Timer");
     timeText = Timer.GetComponent <Text> ();
     blurScript = GameObject.Find ("FirstPersonCharacter").GetComponent<BlurOptimized> ();
     hudPanel = GameObject.Find ("HUD");
     managerScript = GameObject.Find ("New_Player").GetComponent<Game_Manager> ();
     levelBestText = GameObject.Find ("BestText").GetComponent<Text>();
     levelBestText.text = levelBest.ToString();
 }
Ejemplo n.º 35
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
         instance = this;
     else if (instance != this)
         Destroy(gameObject);
     current_state = Game_States.START;
     DontDestroyOnLoad(gameObject);
     scene_loaded = false;
     Init();
 }
Ejemplo n.º 36
0
 // Use this for initialization
 void Start()
 {
     Door_Anim = Door.GetComponent <Animator> ();
     Player = GameObject.FindWithTag ("Player");
     GM = Player.GetComponent<Game_Manager> ();
 }
Ejemplo n.º 37
0
	void Awake () {
		sInstance = this;
	}