Ejemplo n.º 1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
        }

        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            inventory.Load();
        }
    }
Ejemplo n.º 2
0
    //public levelcount data;

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Ladder"))
        {
            levelcount.scorevalue += 1;
            life.SaveFile();
            inventory.Save();
            level.datasave();
            SceneManager.LoadScene("Game"); //Load scene called Game
            //Time.timeScale = 0.000001f;
            transform.position = Vector3.zero;
        }
    }
Ejemplo n.º 3
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);
                    }
                }
                ;
            }
        }
    }
Ejemplo n.º 4
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");
        }
    }
Ejemplo n.º 5
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();
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 7
0
Archivo: Player.cs Proyecto: Khoryn/IDJ
    private void OnApplicationQuit()
    {
        inventory.Save();
        equipment.Save();

        inventory.Clear();
        equipment.Clear();
    }
Ejemplo n.º 8
0
 void Save()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
         Debug.Log("Game Saved");
     }
 }
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.O))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.P))
     {
         inventory.Load();
     }
 }
Ejemplo n.º 10
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.J))
     {
         inventoryObject.Save();
     }
     if (Input.GetKeyDown(KeyCode.K))
     {
         inventoryObject.Load();
     }
 }
Ejemplo n.º 11
0
    }//end of OnTriggerEnter

    void CheckForInventory()
    {
        if (playerInput.saveInventory)
        {
            inventory.Save();
        }
        if (playerInput.loadInventory)
        {
            inventory.Load();
        }
    }
Ejemplo n.º 12
0
    public void OnTriggerEnter(Collider other) //Make it clickable later
    {
        var item = other.GetComponent <Item>();

        if (item)
        {
            Inventory.AddItem(item.item, 1);
            Inventory.Save();
            Destroy(other.gameObject, 0.5f);
        }
    }
Ejemplo n.º 13
0
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     else if (Input.GetKeyDown(KeyCode.F1))
     {
         inventory.Load();
     }
 }
Ejemplo n.º 14
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     else if (Input.GetKeyDown(KeyCode.Return))
     {
         inventory.Load();
     }
 }
Ejemplo n.º 15
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.S))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.L))
     {
         inventory.Load();
     }
 }
    void OnApplicationQuit()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            InventoryObject invOb = transform.GetChild(i).GetComponent <InventoryObject>();

            if (invOb != null)
            {
                invOb.Save(invOb.GetType().ToString());
            }
        }
    }
Ejemplo n.º 17
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));
            }
        }
    }
Ejemplo n.º 18
0
 private void Update()
 {
     //  Debug.Log(boneCombiner._RootBoneDictionary);
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.Save();
     }
     if (Input.GetKeyDown(KeyCode.KeypadEnter))
     {
         inventory.Load();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 20
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();
     }
 }
Ejemplo n.º 21
0
 private void Update()
 {
     if (Input.GetKeyDown(saveKey))
     {
         inventory.Save();
         Debug.Log("Saved inventory!");
     }
     if (Input.GetKeyDown(loadKey))
     {
         inventory.Load();
         Debug.Log("Loaded inventory!");
     }
 }
Ejemplo n.º 22
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F5))
        {
            inventory.Save();
            equipment.Save();
        }

        if (Input.GetKeyDown(KeyCode.F9))
        {
            inventory.Load();
            equipment.Load();
        }
    }
Ejemplo n.º 23
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();
     }
 }
Ejemplo n.º 24
0
    // 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");
        }
    }
Ejemplo n.º 25
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();
    }
Ejemplo n.º 26
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();
     }
 }
Ejemplo n.º 27
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");
     }
 }
Ejemplo n.º 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");
        }
    }
Ejemplo n.º 29
0
    private void Update()
    {
        //SAVE
        if (Input.GetKeyDown(KeyCode.Space))
        {
            inventory.Save();
            equipment.Save();
        }

        //LOAD
        if (Input.GetKeyDown(KeyCode.L))
        {
            inventory.Load();
            equipment.Load();
        }
    }
Ejemplo n.º 30
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();
        }
    }