Пример #1
0
    void Start()
    {
        bar       = GameObject.FindGameObjectWithTag("BatteryBar").GetComponent <BatteryBar>();
        bar.torch = this;
        bar.pLife = this.GetComponent <Life>();

        SetLight(false);
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        if (s_instance != null)
        {
            Destroy(this);
        }

        s_instance = this;
        DontDestroyOnLoad(this);
    }
Пример #3
0
        /*
         * 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;
            }
        }
Пример #4
0
 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;
     }
 }
Пример #5
0
    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);
        }
    }
Пример #6
0
 public void OnNoteFail(PointsData pointsData)
 {
     BatteryBar.hit();
 }
Пример #7
0
 private void Awake()
 {
     idText  = GetComponentInChildren <Text>();
     battery = GetComponentInChildren <BatteryBar>();
 }