Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        controller = GameObject.FindObjectOfType <WeightPuzzleController>().GetComponent <WeightPuzzleController>();
        anim       = anim = gameObject.GetComponentInChildren <Animator>();
        target     = GameObject.Find("Player");
        audio      = GetComponent <AudioSource>();

        if (points.Length == 0)
        {
            return;
        }
        destPoint = Random.Range(0, points.Length);

        // 무작위로 시작 포지션 지정
        run         = false;
        destination = points[destPoint];
        GotoNextPoint();
    }
Example #2
0
    public void ChanageSettings(string name)
    {
        if (name == "3.PanelPuzzle")
        {
            stage      = 1;
            Lives      = new GameObject[3];
            FlipCounts = new GameObject[3];

            puzzleController = GameObject.Find("PanelPuzzle").GetComponent <PanelPuzzleController>();

            // 초기 세팅
            FlipCounts[0] = this.transform.Find("Flip Counts").Find("Pizza 1").gameObject;
            FlipCounts[1] = this.transform.Find("Flip Counts").Find("Pizza 2").gameObject;
            FlipCounts[2] = this.transform.Find("Flip Counts").Find("Pizza 3").gameObject;

            Lives[0] = this.transform.Find("Hearts").Find("Heart 1").gameObject;
            Lives[1] = this.transform.Find("Hearts").Find("Heart 2").gameObject;
            Lives[2] = this.transform.Find("Hearts").Find("Heart 3").gameObject;

            return;
        }
        else if (name == "4.WeightScale")
        {
            if (playerScript == null)
            {
                playerScript = GameObject.Find("Player").GetComponent <Player>();
            }
            stage            = 2;
            weightController = GameObject.Find("Weight Puzzle Stage").GetComponent <WeightPuzzleController>();
            timerText        = transform.Find("InfoText").Find("Timer").GetComponent <TextMeshProUGUI>();
            Hands            = new GameObject[2];
            Hands[0]         = GameObject.Find("HandPoint");
            Hands[1]         = GameObject.Find("HandGrab");
            Hands[0].SetActive(true);
            Hands[1].SetActive(false);
        }

        if (name != "3.PanelPuzzle")
        {
            if (playerScript == null)
            {
                playerScript = GameObject.Find("Player").GetComponent <Player>();              // 플레이어 스크립트
            }
            if (weightText == null)
            {
                weightText = WeightSlider.GetComponentInChildren <TextMeshProUGUI>();                     // 체중을 나타낼 텍스트
            }
            if (hpText == null)
            {
                hpText = HPSlider.GetComponentInChildren <TextMeshProUGUI>();                                   // HP를 나타낼 텍스트
            }
            if (fuelText == null)
            {
                fuelText = FuelSlider.GetComponentInChildren <TextMeshProUGUI>();                              // 연료량을 나타낼 텍스트
            }
            if (avatar == null)
            {
                avatar = HPSlider.transform.Find("IconImage").GetComponent <Image>();    // 플레이어 아바타 이미지
            }
            // 게이지에 표기할 값 가져오기
            if (WeightSlider != null)
            {
                WeightSlider.maxValue = playerScript.Weight;
            }

            if (HPSlider != null)
            {
                HPSlider.maxValue = playerScript.Hp;
            }

            if (FuelSlider != null)
            {
                FuelSlider.maxValue = playerScript.MaxFuel;
            }
        }

        // 게임오버 시 게임오버화면 표시
        result.SetActive(false);
    }