Beispiel #1
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)
             {
                 if (pwrMngr.EnoughPower(fullPwrReq))
                 {
                     //try power up
                     SystemScript _sysScr = sysScr.GetOriginObj().GetComponent <SystemScript> ();
                     _sysScr.UpdatePowerState(true);
                 }
                 else
                 {
                     Debug.LogError("not enough power");
                 }
             }
         }
     }
     else
     {
         weaponSysScr.ReceivePowerUpdate(_isPowered);
     }
 }
Beispiel #2
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);
        }
    }
Beispiel #3
0
    private void Setup()
    {
        sysScr   = GetComponent <SystemScript>();
        gridPos  = sysScr.GridPos;
        playerID = gridPos.Z;

        ship    = LevelManager.Instance.Ships[playerID].GetComponent <ShipScript>();
        pwrMngr = ship.GetComponent <ShipPowerMngr>();

        hScr = sysScr.GetOriginObj().GetComponent <HealthScript>();

        pwrMngr.PowerSetup(systemType, powerReq);


        originMedBayScr = GetOriginMedBay();
        if (this == originMedBayScr)
        {
            isOrigin = true;
        }

        //originEngScr.fullPwrReq += powerReq;

        if (isOrigin)
        {
            pwrMngr.AddToSysScrList(systemType, sysScr);

            StartCoroutine(HealRoutine());
        }
    }
Beispiel #4
0
    private void Setup()
    {
        sysScr   = GetComponent <SystemScript>();
        gridPos  = sysScr.GridPos;
        playerID = gridPos.Z;

        ship    = LevelManager.Instance.Ships[playerID].GetComponent <ShipScript>();
        pwrMngr = ship.GetComponent <ShipPowerMngr>();

        hScr = sysScr.GetOriginObj().GetComponent <HealthScript>();

        //ship.IncreaseEvasionChance (componentCapacity);

        pwrMngr.PowerSetup(systemType, powerReq);

        originTeleporterScr = GetOriginTelScr();
        if (this == originTeleporterScr)
        {
            isOrigin = true;
        }

        originTeleporterScr.fullPwrReq += powerReq;

        if (isOrigin)
        {
            pwrMngr.AddToSysScrList(systemType, sysScr);
        }

        RoomScript _room = transform.parent.parent.GetChild(0).GetChild(0).GetComponent <RoomScript>();

        room = _room.GetOriginObj().GetComponent <RoomScript>();
    }
    private void Setup()
    {
        sysScr  = GetComponent <SystemScript>();
        gridPos = sysScr.GridPos;

        //needs more info...
        //ship = LevelManager.Instance.Ships [playerID].GetComponent <ShipScript> ();
        GameObject _ship = transform.parent.parent.parent.parent.gameObject;

        //ShipScript _shipScr = _ship.GetComponent <ShipScript> ();
        pwrMngr = _ship.GetComponent <ShipPowerMngr> ();
        hScr    = sysScr.GetOriginObj().GetComponent <HealthScript> ();

        //Debug.LogError (_ship.transform.childCount);

        if (_ship.transform.childCount < 7)
        {
            //if (_ship.transform.GetChild (7) == null) {
            //Debug.LogError ("shield stuff called");

            GameObject _shield = (GameObject)Instantiate(shield, _ship.transform);
            shield = _shield;

            shieldScr = shield.GetComponent <ShieldScript> ();
            shieldScr.Setup(gridPos.Z);

            /*
             * GameObject _field = _ship.transform.GetChild (1).gameObject;
             *
             * shield.transform.position = _field.transform.position;
             * shield.transform.localScale = (_field.transform.localScale * 16 / 1920);
             * //float _scale = (Screen.width / shield.GetComponent <SpriteRenderer> ().bounds.size.x);
             * float _scale0 = (_field.transform.localScale.x * 16 / 1920);
             * float _scale1 = (_field.transform.localScale.y * 16 / 1080);
             * //shield.transform.localScale = new Vector3 (_scale, _scale, _scale);
             *
             * shield.transform.localScale = new Vector3 (_scale0, _scale1);
             */
        }
        else
        {
            //Debug.LogError ("no shield stuff called");

            shield    = _ship.transform.GetChild(6).gameObject;
            shieldScr = shield.GetComponent <ShieldScript> ();
        }

        //IncreaseShieldCapacity (shieldBoost);
        pwrMngr.PowerSetup(systemType, powerReq);

        originShldSys             = GetOriginShielSystem();
        originShldSys.fullPwrReq += powerReq;

        if (this == originShldSys)
        {
            isOrigin = true;
            pwrMngr.AddToSysScrList(systemType, sysScr);
        }
    }
    //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);
    }
Beispiel #7
0
    private void Setup()
    {
        sysScr   = GetComponent <SystemScript>();
        gridPos  = sysScr.GridPos;
        playerID = gridPos.Z;

        ship    = LevelManager.Instance.Ships [playerID].GetComponent <ShipScript> ();
        pwrMngr = ship.GetComponent <ShipPowerMngr> ();

        hScr = sysScr.GetOriginObj().GetComponent <HealthScript> ();

        //ship.IncreaseEvasionChance (componentCapacity);

        pwrMngr.PowerSetup(systemType, powerReq);

        originEngScr = GetOriginEngine();
        if (this == originEngScr)
        {
            isOrigin = true;
        }

        originEngScr.fullPwrReq += powerReq;

        if (isOrigin)
        {
            pwrMngr.AddToSysScrList(systemType, sysScr);
        }

        /* 220418
         * if (NetManager.Instance != null) {
         *      if (playerID == NetManager.Instance.localPlayerID) {
         *              PowerManager.Instance.GetEngine (this);
         *              PowerManager.Instance.UpdateSystemCapacity (systemType, powerReq);
         *              isLocal = true;
         *      }
         * }
         */
    }
Beispiel #8
0
    private void Setup()
    {
        sysScr   = GetComponent <SystemScript> ();
        gridPos  = sysScr.GridPos;
        playerID = gridPos.Z;

        ship    = LevelManager.Instance.Ships [playerID].GetComponent <ShipScript> ();
        pwrMngr = ship.GetComponent <ShipPowerMngr> ();

        hScr = sysScr.GetOriginObj().GetComponent <HealthScript> ();

        //ship.IncreaseEvasionChance (componentCapacity);

        pwrMngr.PowerSetup(systemType, powerReq);

        weaponSysScr = GetOriginWeaponSys();
        if (this == weaponSysScr)
        {
            isOrigin = true;
            pwrMngr.AddToSysScrList(systemType, sysScr);
        }

        weaponSysScr.fullPwrReq += powerReq;
    }