Пример #1
0
    void Start()
    {
        rb        = gameObject.GetComponent <Rigidbody2D> ();
        couchCrew = transform.parent.parent.GetComponent <CouchCrewScript> ();

        controllerID = couchCrew.ControllerID;
    }
Пример #2
0
    public void StopUsingTerminal()
    {
        /*
         * //Camera.main.enabled = false;
         * Camera _shipCam = LevelManager.Instance.Ships[0].GetComponent <ShipScript> ().ShipCam;
         * if (_shipCam == null) {
         *      Debug.LogError ("no cam!");
         * } else {
         *      _shipCam.gameObject.SetActive (false);
         * }
         */

        isUsed = false;

        userScr = null;

        //_user.SetCrewCamValues (ship, false);

        //whats the purpose of this?
        if (currentWeapon != null)
        {
            currentWeapon.HandleOutline(false, userColor);
            currentWeapon.isUsedByCrew = false;

            //wait what? ill comment this out. 270518
            //currentWeapon.IsPowered = true;
        }
    }
Пример #3
0
    public void Teleport(Point _point, bool _from)
    {
        if (isPowered)
        {
            List <CouchCrewScript> _crewList = new List <CouchCrewScript>();

            if (_from)
            {
                List <HealthScript> _hList = room.GetAllHScr();
                //List<CouchCrewScript> _crewList = new List<CouchCrewScript>();
                foreach (var _hScr in _hList)
                {
                    //_crewList.Add(_hScr.GetComponent<CrewScript>());
                    CouchCrewScript _crew = _hScr.GetComponent <CouchCrewScript>();
                    _crewList.Add(_crew);
                    //_crew.Teleport(_point); might've caused issues?
                }
            }
            else
            {
                RoomScript          _room     = LevelManager.Instance.Tiles[_point].transform.GetChild(0).GetChild(0).GetComponent <RoomScript>();
                RoomScript          _roomOrig = _room.GetOriginObj().GetComponent <RoomScript>();
                List <HealthScript> _hList    = _room.GetAllHScr();
                //List<CouchCrewScript> _crewList = new List<CouchCrewScript>();
                _point = room.GridPos;

                foreach (var _hScr in _hList)
                {
                    //_crewList.Add(_hScr.GetComponent<CrewScript>());
                    CouchCrewScript _crew = _hScr.GetComponent <CouchCrewScript>();
                    _crewList.Add(_crew);
                    //_crew.Teleport(_point); might've caused issues?
                }
            }

            foreach (var _crew in _crewList)
            {
                _crew.Teleport(_point);
            }
        }
        else
        {
            Debug.LogError("porter aint powered!");
        }
    }
Пример #4
0
    public void AssignController(CouchCrewScript _couchCrew, int _shipID)
    {
        //crew placement os too fast for network sync
        //-> count needs to be increased twice, once for placement, once for controller

        assignedCrewCount++;
        string _ctrlID = crewAssignments[_shipID][0];

        Debug.Log("ass-ignment: " + _ctrlID);

        _couchCrew.CouchCrewSetup(_ctrlID, assignedCrewCount, couchPlayerCount);
        //_couchCrew.CouchCrewSetup (ctrlDict [assignedCrewCount - 1], assignedCrewCount, couchPlayerCount);

        //Debug.LogError("pre");
        crewAssignments[_shipID].Remove(_ctrlID);
        //Debug.LogError("post");

        //_couchCrew.CouchCrewSetup (ctrlDict [couchCrewCount - 1], couchCrewCount, couchPlayerCount);
    }
Пример #5
0
    public void UseTerminal(CouchCrewScript _user)
    {
        //Debug.LogError ("hello there mr. crew!");
        userScr = _user;


        isUsed = true;

        shipArr = LevelManager.Instance.Ships;

        //numOfShips = NetManager.Instance.NumOfPlayers;
        numOfShips = CasheScript.Instance.ShipList.Count;
        //Debug.LogError ("numOfShips: " + numOfShips);

        userColor = _user.CrewColor;
        //gun terminal behaviour

        //switch to full ship view

        //Camera.main.enabled = true;

        SetCrewCam();

        /*
         *      ship = LevelManager.Instance.Ships[targetedShipID].GetComponent <ShipScript> ();
         *      Camera _shipCam = ship.ShipCam;
         *      if (_shipCam == null) {
         *              Debug.Log ("no cam!");
         *      } else {
         *              //_shipCam.gameObject.SetActive (true);
         *              _user.SetCrewCamValues (ship, true);
         *      }
         */



        /*
         *      GameObject _sysObj = transform.parent.parent.GetChild (1).gameObject;
         *      if (_sysObj.transform.childCount > 0) {
         *              if (_sysObj.transform.GetChild (0).GetComponent <WeaponSysScr> () != null) {
         *                      weaponSysScr = _sysObj.transform.GetChild (0).GetComponent <WeaponSysScr> ();
         *              } else {
         *                      Debug.Log ("weaponSysScr == null");
         *              }
         *      }
         */


        /*
         *      //should be outsourced to weaponTerminal subScr?
         *      if (ship.WeaponList.Count > currentWeaponID) {
         *              currentWeapon = ship.WeaponList [currentWeaponID];
         *      }
         *
         *      if (currentWeapon != null) {
         *              currentWeapon.IsPowered = true;
         *      }
         */

        if (isWeaponTerminal)
        {
            GetWeapon();
            GiveTerminalReference(_user);

            //when terminal is used -> sys is powered.
            //for weaponScr that means, that you may distribute any available weaponPower
            //players can only do that by using a terminal.
            //-> there may be weaponSys without terminals, but you can't interface with it, just boost the available power


            //enabe cursor //-> where does it start?

            //while in this view, deactivate couchCrew movement

            //o exits the terminal

            SwapWeapon(1);
        }
        else if (isTeleporterTerminal)
        {
            GiveTerminalReference(_user);
        }
    }
Пример #6
0
 //gives terminal reference to cursor
 private void GiveTerminalReference(CouchCrewScript _user)
 {
     _user.GiveTerminalReference(this);
 }