コード例 #1
0
        public void RemoveItem(int itemLocation)
        {
            if (itemLocation < 0 || itemLocation >= InventoryList.Count)
            {
                errorHandler.ReportError("Attempting to remove inventory item from invalid location", ErrorState.close_window);
                return;
            }

            InventoryList.RemoveAt(itemLocation);
            foreach (InventoryItem inventoryItem in InventoryList)
            {
                inventoryItem.InventoryLocation = InventoryList.IndexOf(inventoryItem);
            }
            inventoryUI.UpdateInventory(InventoryList);
            if (InventoryList.Count == 0)
            {
                touristManager.GenerateTourist();
            }
        }
コード例 #2
0
        protected override void Start()
        {
            base.Start();
            if (gameObject.activeSelf)
            {
                if (componentMissing == true)
                {
                    errorHandler.ReportError("Player Character missing component", ErrorState.restart_scene);
                }
                else
                {
                    landmarkParser = globeParser.LandmarkParser;
                    if (landmarkParser == null)
                    {
                        errorHandler.ReportError("Landmark parser missing", ErrorState.restart_scene);
                    }

                    navigationUI = uiManager.NavigationUI;
                    if (navigationUI == null)
                    {
                        errorHandler.ReportError("Navigation UI missing", ErrorState.restart_scene);
                    }

                    touristManager = gameManager.TouristManager;
                    if (touristManager == null)
                    {
                        errorHandler.ReportError("Tourist Manager missing", ErrorState.restart_scene);
                    }
                    else
                    {
                        for (int i = 0; i < STARTING_NUMBER_OF_TOURISTS; i++)
                        {
                            touristManager.GenerateTourist();
                        }
                    }

                    cameraManager = gameManager.CameraManager;
                    if (cameraManager == null)
                    {
                        errorHandler.ReportError("Camera Manager missing", ErrorState.restart_scene);
                    }
                    else
                    {
                        cameraManager.OrientOnLocation(VectorLocation);
                    }

                    turnsManager = gameManager.TurnsManager;
                    if (turnsManager == null)
                    {
                        errorHandler.ReportError("Turns Manager missing", ErrorState.restart_scene);
                    }
                    else
                    {
                        turnsManager.TurnBasedObjects.Add(this);
                    }

                    Vehicle.InitVehicles();
                    ClimateCosts = Vehicle.GetClimateVehicle("Mild");
                    UpdateLocation(CellLocation.index);
                }
            }
        }