コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!Environment.GameOver)
        {
            //추력버튼 입력에 따른 값 드론에 전달

            Player.AddControll(ThrustAddValue);

            ScoreText.text     = environment.MissionScore.ToString();
            MoneyText.text     = environment.AmountMoney.ToString();
            BombCountText.text = "X " + environment.LeftBombCount.ToString();
            TimeCount          = string.Format("{0:0} 초", environment.SW.ElapsedMilliseconds * 0.001);
            TimeText.text      = TimeCount;
            Fuel               = Player.Fuel;
            MaxFuel            = Player.Max_Fuel;
            FuelBar.fillAmount = (float)Fuel / (float)MaxFuel;
            if (Fuel < 20)
            {
                FuelBar.color = new Color32(255, 66, 66, 208);
            }
            else
            {
                FuelBar.color = new Color32(255, 255, 169, 208);
            }

            Main_HP              = environment.Main_HP;
            Main_MaxHP           = environment.Main_MaxHP;
            MainHPBar.fillAmount = (float)Main_HP / (float)Main_MaxHP;
            if (Main_HP < 20)
            {
                MainHPBar.color = new Color32(255, 66, 66, 208);
            }
            else
            {
                MainHPBar.color = new Color32(214, 214, 214, 255);
            }

            //MainHuman과 Drone의 거리를 재서 배터리 교체버튼 활성화 여부 결정
            if (Vector3.Distance(MainHuman.transform.position, Player.transform.position) < 4.5f)
            {
                BatteryChangeButton.SetActive(true);
            }
            else
            {
                BatteryChangeButton.SetActive(false);
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                Fire();
            }
        }
    }