Exemplo n.º 1
0
    //to all
    public void ReceivePowerUpdate(bool _isPowered)
    {
        if (isOrigin)
        {
            if (isPowered)
            {
                //tryPowerDown
                if (pwrMngr.EnoughPower(fullCapacity))
                {
                    //Debug.Log ("canPowerDown");
                    SystemScript _sysScr = sysScr.GetOriginObj().GetComponent <SystemScript> ();
                    _sysScr.UpdatePowerState(false);                      //(_isPowered);
                }
                else
                {
                    //shut down random system & call ReceivePowerUpdate again

                    //Debug.LogError ("cant shut down! initiating emergency shutdown");
                    ShutDownRandomSystem(_isPowered);
                }
            }
            else
            {
                if (!hScr.IsFullyDamaged)
                {
                    SystemScript _sysScr = sysScr.GetOriginObj().GetComponent <SystemScript> ();
                    _sysScr.UpdatePowerState(true);                      //(_isPowered);
                }
            }
        }
        else
        {
            originReactorScr.ReceivePowerUpdate(_isPowered);
        }
    }
Exemplo n.º 2
0
    //to all
    public void ReceivePowerUpdate(bool _isPowered)
    {
        if (isOrigin)
        {
            if (isPowered)
            {
                SystemScript _sysScr = sysScr.GetOriginObj().GetComponent <SystemScript> ();
                _sysScr.UpdatePowerState(false);
            }
            else
            {
                if (!hScr.IsFullyDamaged)
                {
                    //Debug.Log ("req: " + powerReq);
                    //Debug.Log ("full req: " + originShldSys.fullPwrReq);

                    if (pwrMngr.EnoughPower(fullPwrReq))
                    {
                        //try power up
                        SystemScript _sysScr = sysScr.GetOriginObj().GetComponent <SystemScript> ();
                        _sysScr.UpdatePowerState(true);

                        //pwrMngr.PowerDistribution (systemType, powerReq, this);
                        //isPowered = true;
                    }
                    else
                    {
                        Debug.Log("not enough power");
                    }
                }
            }
        }
        else
        {
            originShldSys.ReceivePowerUpdate(_isPowered);
        }

        //SystemScript _sysScr = systemScr.GetOriginObj ().GetComponent <SystemScript> ();
        //_sysScr.UpdatePowerState (_isPowered);
    }