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);
        }
    }
示例#2
0
 void Start()
 {
     playerMeshGenerator.unityMesh = new UnityEngine.Mesh();
     playerShield.Setup();
     mesh                    = playerMeshGenerator.unityMesh;
     meshFilter.mesh         = mesh;
     meshCollider.sharedMesh = mesh;
     meshRenderer.enabled    = false;
     this.transform.Rotate(90, 0, 0);
 }