コード例 #1
0
        private void Awake()
        {
            // initialise cargo
            cargo = new Inventory();

            // if player ship, set inventory to gamemanager's inventoryui
            if (isPlayer)
            {
                if (GameManager.InventoryUI != null && GameManager.InventoryUI.gameObject.activeSelf)
                {
                    GameManager.InventoryUI.SetInventory(cargo);
                }
                else
                {
                    Debug.LogWarning("The InventoryUI is either not set or it's inactive for the " + this.name + " ship");
                }
            }

            // initialise augments
            augments = new Inventory();

            // interior starts visible
            isScannerWorking = true;

            // add ship rooms to rooms list
            for (int i = 0; i < roomsParent.transform.childCount; i++)
            {
                rooms.Add(roomsParent.transform.GetChild(i).gameObject);
            }

            // get weapons room
            WeaponsRoom = GetComponentInChildren <WeaponsRoom>();

            // create rooms icons parent on battle ui manager
            roomIconsParent      = new GameObject();
            roomIconsParent.name = this.name;
            GameObject roomIconsCanvasGO = GameManager.BattleUiManager.roomIconCanvas;

            roomIconsParent.transform.SetParent(roomIconsCanvasGO.transform);

            // generate grid
            if (isPlayer)
            {
                pathGrid.Generate(this);
            }
        }
コード例 #2
0
        private void Start()
        {
            CheckNeighbourRooms();

            weaponsRoom = this.transform.parent.GetComponent <WeaponsRoom>();
        }