Beispiel #1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
        }

        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            inventory.Load();
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F5))
        {
            inventory.Save();
        }
        if (Input.GetKeyDown(KeyCode.F6))
        {
            inventory.Load();
        }



        if (Input.GetMouseButtonDown(0))
        {
            var data = getDistanceOnClick();
            if (data != null)
            {
                var currentObj  = data.Value.obj;
                var currentDist = data.Value.dist;
                if (currentObj.CompareTag("Chest") && currentDist <= 2f)
                {
                    var item = currentObj.GetComponent <ChestLoot>();
                    if (item)
                    {
                        inventory.addItem(item.item, 1);
                        Destroy(currentObj);
                    }
                }
                ;
            }
        }
    }
Beispiel #3
0
    private void Update()
    {
        if (Input.GetKeyDown("o"))
        {
            inventory.Save();
            equipment.Save();
            //Debug.Log("Inventory Saved");
        }
        if (Input.GetKeyDown("p"))
        {
            inventory.Load();
            equipment.Load();
            //Debug.Log("Inventory Loaded");
        }

        OpenInventory();

        if (inventoryopen == true)
        {
            playerInventory.gameObject.SetActive(true);
            //Debug.Log("Inventory Open");
        }
        if (inventoryopen == false)
        {
            playerInventory.gameObject.SetActive(false);
            //Debug.Log("Inventory Closed");
        }
    }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            zoomInToLocation();
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            zoomOutToLocation();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.Log("SHOULD BE SAVING");
            inventory.Save();
        }
        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            Debug.Log("SHOULD BE LOADING");
            inventory.Load();
        }

        moveDirection = Input.GetAxis("Horizontal");
        if (Input.GetButtonDown("Jump"))
        {
            isJumping = true;
        }

        Animate();
    }
    IEnumerator LoadInventories()
    {
        yield return(new WaitForSeconds(0.3f));

        inventory.Load();
        equipment.Load();
    }
Beispiel #6
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            equipment.Save();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            inventory.Load();
            equipment.Load();
        }

        if (Input.GetKeyDown(KeyCode.U))
        {
            level.AddExp(level.GetXPForLevel(level.currLevel));
        }

        float hAxis = Input.GetAxis("Horizontal");
        float vAxis = Input.GetAxis("Forward");

        Vector3 movement = new Vector3(hAxis, 0, vAxis) * speed * Time.deltaTime;

        rb.MovePosition(transform.position + movement);
    }
    public void Load(PlayerData data)
    {
        gold = data.gold;
        transform.position = new Vector3(data.position[0], data.position[1], data.position[2]);

        InventoryController.Instance.PopulateSlots();
        inventory.Load(data.inventory);
    }
Beispiel #8
0
 void Load()
 {
     if (Input.GetKeyDown(KeyCode.L))
     {
         inventory.Load();
         Debug.Log("Game loaded");
     }
 }
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     else if (Input.GetKeyDown(KeyCode.F1))
     {
         inventory.Load();
     }
 }
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.O))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.P))
     {
         inventory.Load();
     }
 }
Beispiel #11
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     else if (Input.GetKeyDown(KeyCode.Return))
     {
         inventory.Load();
     }
 }
    }//end of OnTriggerEnter

    void CheckForInventory()
    {
        if (playerInput.saveInventory)
        {
            inventory.Save();
        }
        if (playerInput.loadInventory)
        {
            inventory.Load();
        }
    }
Beispiel #13
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.J))
     {
         inventoryObject.Save();
     }
     if (Input.GetKeyDown(KeyCode.K))
     {
         inventoryObject.Load();
     }
 }
Beispiel #14
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.S))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.L))
     {
         inventory.Load();
     }
 }
Beispiel #15
0
    void SaveAndLoadGame()
    {
        if (gameSave)
        {
            if (Input.GetKeyDown(KeyCode.K))
            {
                gameSaveText.gameObject.SetActive(true);
                gameSaveText.text = "Save Game...Please Wait";
                gameSave          = false;
                playerExperience  = LevelSystem.experience;
                playerLevel       = LevelSystem.currentLevel;
                playerPositionX   = transform.position.x;
                playerPositionY   = transform.position.y;
                Debug.Log("save");
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerGold         = currentGold;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerHP           = playerCurrentHP;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerMana         = playerCurrentMana;
                ProtectedSaveFiles.Basic.SaveController.Data.SaveCurrentEXP         = LevelSystem.experience;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLevel        = LevelSystem.currentLevel;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLocationX    = transform.position.x;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLocationY    = transform.position.y;
                ProtectedSaveFiles.Basic.SaveController.Data.SaveCharacterSelection = currentCharacterSelection;
                ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerScene        = SceneManager.GetActiveScene().name;

                ProtectedSaveFiles.Basic.SaveController.Save();
                inventory.Save();
                equipment.Save();
                StartCoroutine(WaitForSeconds(1f));
            }
            if (Input.GetKeyDown(KeyCode.L))
            {
                gameSaveText.gameObject.SetActive(true);
                gameSaveText.text = "Load Game...Please Wait";
                gameSave          = false;
                Debug.Log("load");
                ProtectedSaveFiles.Basic.SaveController.Load();
                currentGold               = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerGold;
                playerCurrentHP           = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerHP;
                playerCurrentMana         = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerMana;
                playerExperience          = ProtectedSaveFiles.Basic.SaveController.Data.SaveCurrentEXP;
                playerLevel               = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLevel;
                playerPositionX           = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLocationX;
                playerPositionY           = ProtectedSaveFiles.Basic.SaveController.Data.SavePlayerLocationY;
                currentCharacterSelection = ProtectedSaveFiles.Basic.SaveController.Data.SaveCharacterSelection;


                transform.position = new Vector2(playerPositionX, playerPositionY);
                inventory.Load();
                equipment.Load();
                StartCoroutine(WaitForSeconds(1f));
            }
        }
    }
Beispiel #16
0
 private void Update()
 {
     //  Debug.Log(boneCombiner._RootBoneDictionary);
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.KeypadEnter))
     {
         inventory.Load();
     }
 }
Beispiel #17
0
 private void Update()
 {
     if (Input.GetKeyDown(saveKey))
     {
         inventory.Save();
         Debug.Log("Saved inventory!");
     }
     if (Input.GetKeyDown(loadKey))
     {
         inventory.Load();
         Debug.Log("Loaded inventory!");
     }
 }
Beispiel #18
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log("Saving");
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         Debug.Log(":Loading");
         inventory.Load();
     }
 }
Beispiel #19
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log("Saving Inventory");
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.L))
     {
         Debug.Log("Loading Inventory");
         inventory.Load();
     }
 }
    // Update is called once per frame
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            Debug.Log("Space Pressed");
        }

        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            inventory.Load();
            Debug.Log("Enter Pressed");
        }
    }
Beispiel #21
0
 private void Update()
 {
     this.transform.position = new Vector3(cam.transform.position.x, -1f, transform.position.y);
     if (Input.GetKeyDown(KeyCode.F11))
     {
         inventory.Save();
         distellery.Save();
     }
     if (Input.GetKeyDown(KeyCode.F12))
     {
         inventory.Load();
         distellery.Load();
     }
 }
Beispiel #22
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F5))
        {
            inventory.Save();
            equipment.Save();
        }

        if (Input.GetKeyDown(KeyCode.F9))
        {
            inventory.Load();
            equipment.Load();
        }
    }
Beispiel #23
0
    // Update is called once per frame
    void Update()
    {
        Vector3      mousePos          = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2      mousePos2D        = new Vector2(mousePos.x, mousePos.y);
        RaycastHit2D hit               = Physics2D.Raycast(mousePos2D, Vector2.zero);
        Vector2      mousePos2DRounded = new Vector2(Mathf.Round(mousePos2D.x), Mathf.Round(mousePos2D.y) * 0.5f);

        if (Input.GetMouseButtonDown(0))
        {
            if (hit.collider != null && hit.collider.tag == "canpickup")
            {
                var item = hit.collider.gameObject.GetComponent <GroundItem>();

                if (item)
                {
                    inventory.AddItem(new Item(item.item), 1);
                    //inventory.AddItem(item.item, 1);
                    Destroy(hit.collider.gameObject);
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            zoomInToLocation();
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            zoomOutToLocation();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.Log("SHOULD BE SAVING");
            inventory.Save();
        }
        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            Debug.Log("SHOULD BE LOADING");
            inventory.Load();
        }

        moveDirection = Input.GetAxis("Horizontal");
        if (Input.GetButtonDown("Jump"))
        {
            isJumping = true;
        }

        Animate();
    }
Beispiel #24
0
 private void Update()                    //update only on key press
 {
     if (Input.GetKeyDown(KeyCode.Space)) //allow saving inventory
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.KeypadEnter)) //allow loading inventory
     {
         inventory.Load();
     }
     if (Input.GetKey("escape")) //allow player to quit application
     {
         Application.Quit();
     }
 }
Beispiel #25
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
         playerEquipment.Save();
         Debug.Log("Saved");
     }
     if (Input.GetKeyDown(KeyCode.KeypadEnter))
     {
         inventory.Load();
         playerEquipment.Load();
         Debug.Log("Loaded");
     }
 }
Beispiel #26
0
    private void Update()
    {
        //SAVE
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            equipment.Save();
        }

        //LOAD
        if (Input.GetKeyDown(KeyCode.L))
        {
            inventory.Load();
            equipment.Load();
        }
    }
Beispiel #27
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            shop.Save();
            equipment.Save();
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            inventory.Load();
            shop.Load();
            equipment.Load();
        }
    }
Beispiel #28
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            equipement.Save();
            Debug.Log("saved");
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            inventory.Load();
            equipement.Load();
            Debug.Log("loaded");
        }
    }
Beispiel #29
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
         fridge.Save();
     }
     if (Input.GetKeyDown(KeyCode.KeypadEnter))
     {
         inventory.Load();
         fridge.Load();
     }
     if (Input.GetKey("escape"))
     {
         Application.Quit();
     }
 }
Beispiel #30
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            inventoryUI.gameObject.SetActive(true);
            inventoryUI.Show();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Item item = new Item(groundItem[0].item);
            inventory.AddItem(item, 2);
        }
        if (Input.GetKey(KeyCode.D))
        {
            if (Input.GetKeyDown(KeyCode.A))
            {
                Item item = new Item(groundItem[0].item);
                inventory.AddItem(item, 1);
            }
            if (Input.GetKeyDown(KeyCode.B))
            {
                Item item = new Item(groundItem[1].item);
                inventory.AddItem(item, 1);
            }
            if (Input.GetKeyDown(KeyCode.F))
            {
                Item item = new Item(groundItem[2].item);
                inventory.AddItem(item, 1);
            }
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            inventory.Save();
        }
        if (Input.GetKeyDown(KeyCode.L))
        {
            inventory.Load();
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            inventory.Clear();
        }
    }