private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Interactive")) { IChargeable it = other.transform.GetComponent <IChargeable>(); it?.Charging(Bread); Debug.Log("Charge"); } }
private void Recharge() { foreach (Item item in AttachedContainer.Container.Items) { IChargeable chargeable = item.GetComponent <IChargeable>(); if (chargeable != null) { chargeable.AddCharge(chargeable.GetChargeRate()); } } }
private void ManufacturerInitializeComputersFromInput() { var manufacturerName = Console.ReadLine(); ManufacturerFactory manufacturerCreator = new ManufacturerFactory(); ComputersFactory manufacturer = manufacturerCreator.CreateManufacturer(manufacturerName); this.pc = manufacturer.CreatePc(); this.laptop = manufacturer.CreateLaptop(); this.server = manufacturer.CreateServer(); }
// Recharges the current cell that is placed on it private void Recharge() { foreach (Item item in containerDescriptor.attachedContainer.Container.Items) { IChargeable chargeable = item.GetComponent <IChargeable>(); if (chargeable != null) { chargeable.AddCharge(chargeable.GetChargeRate()); UpdateLights(chargeable.GetPowerPercentage()); } } }
private void Start() { Assert.IsNotNull(AttachedContainer); AttachedContainer.Container.ContentsChanged += (_, items, type) => { // Power cell does not attach to match wires // wiresMeshRenderer.enabled = !AttachedContainer.Container.Empty; if (AttachedContainer.Container.Empty) { // Cell Charger is empty if (isServer) { SyncLightState(BatteryLightState.NO_BATTERY); } } else { // Cell Charger now has a battery in it, so update the lights based on battery charge. // (this prevents the delay between putting a battery in and seeing the lights change) if (isServer) { foreach (Item item in AttachedContainer.Container.Items) { IChargeable chargeable = item.GetComponent <IChargeable>(); if (chargeable != null) { UpdateLights(chargeable.GetPowerPercentage()); } } } } }; if (isServer) { StartCoroutine(StartCharge()); } }
private void RechargePowerCell(Item item) { IChargeable chargeable = item.GetComponent <IChargeable>(); chargeable.AddCharge(chargeable.GetChargeRate()); }
public void BrancherPortable(IChargeable portable) { Console.WriteLine("branchement d'un portable"); this._telephone = portable; this._telephone.Recharger(_volts); }