private void Awake() { isSetScore = ((bool updatescore) => { isSuccess = updatescore; }); _audio = GetComponent <AudioSource>(); BatteryChangeButton.SetActive(false); environment = GameObject.Find("ENVIRONMENT").GetComponent <Environment>(); }
// 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(); } } }
public void SetReference(GameObject[] Refs)//Environment에서 호출 { Player = Refs[0].GetComponent <Drone>(); MainHuman = Refs[1]; GameObject[] tempRefs = new GameObject[3]; tempRefs[0] = Refs[0]; //Drone Object tempRefs[1] = Refs[0].transform.Find("Claw").gameObject; //Claw tempRefs[2] = LiftButtonBG; //리프팅 버튼 Ani //LiftButton.SendMessage("SetReference", tempRefs);//드론, Claw, GrabModeCtrl tempRefs = new GameObject[2]; tempRefs[0] = Refs[0]; tempRefs[1] = Refs[1]; BatteryChangeButton.SendMessage("SetReference", tempRefs); swipeController.SetReference(tempRefs); }