void Start() { bar = GameObject.FindGameObjectWithTag("BatteryBar").GetComponent <BatteryBar>(); bar.torch = this; bar.pLife = this.GetComponent <Life>(); SetLight(false); }
// Use this for initialization void Awake() { if (s_instance != null) { Destroy(this); } s_instance = this; DontDestroyOnLoad(this); }
/* * protected override void OnPropertyChanging([CallerMemberName] string propertyName = null) * { * base.OnPropertyChanging(propertyName); * * * * System.Diagnostics.Debug.WriteLine($"OnPropertyChanging: {propertyName}"); * } */ protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); //System.Diagnostics.Debug.WriteLine($"OnPropertyChanged: {propertyName}"); if (BatteryPercentProperty.PropertyName.Equals(propertyName)) { BatteryBar.AnimateWidthPercent((float)BatteryPercent * 0.01); } else if (BatteryCellsProperty.PropertyName.Equals(propertyName)) { //BatteryCellsView.BindingContext = BatteryCells; } }
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { if (arg0.name.Contains("Stage")) { battery = ModAssets.Instantiate <GameObject>("battery_pre"); BatteryBar.bar = ModAssets.Instantiate <GameObject>("bar_pre"); } else { BatteryBar.GameOverCallback = null; BatteryBar.DestroyBatteryBar(); UnityEngine.Object.Destroy(battery); battery = null; } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { Debug.Log("Player is charging"); //TODO: fix this //Robot robot = other.gameObject.GetComponent<Robot>(); BatteryBar drainbar = other.gameObject.GetComponent <BatteryBar>(); Debug.Log("Player is charged"); drainbar.CurrentBattery = drainbar.GetMaxBattery(); AudioSource.PlayClipAtPoint(chargingSound, transform.position); } }
public void OnNoteFail(PointsData pointsData) { BatteryBar.hit(); }
private void Awake() { idText = GetComponentInChildren <Text>(); battery = GetComponentInChildren <BatteryBar>(); }