private void ConsumePower() { Turret turret; if (component.GetTurret(out turret)) { turret.ConsumePower(powerConsumption * Time.deltaTime); } }
private void Fitted(TurretComponent component, Armament arment) { Turret turret; if (component.GetTurret(out turret)) { turret.RegisterBatery(this); } }
internal virtual bool GetTurret(out Turret turret) { if (parentComponent == null) { turret = null; return(false); } return(parentComponent.GetTurret(out turret)); }
// Update is called once per frame void Update() { Turret turret; if (component.GetTurret(out turret)) { turret.ProducePower(production * Time.deltaTime); } }
void Start() { component = GetComponent <TurretComponent>(); Turret turret; if (component.GetTurret(out turret)) { turret.RegisterBatery(this); } else { component.onFittedEvent += Fitted; } UpdateGlow(); }