Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Monster")
     {
         bloodChange = 40;
         BackpackManager.RemoveGrid();
         BackpackManager.instance.gridNum--;
         Debug.Log(collision.gameObject.name);
         Destroy(collision.gameObject, 0.5f);
     }
     if (collision.tag == "SnakeCost")
     {
         bloodChange = 20;
         BackpackManager.RemoveGrid();
         BackpackManager.instance.gridNum--;
         Debug.Log(collision.gameObject.name);
     }
     //猫头鹰扣血
     if (collision.tag == "Eagle")
     {
         bloodChange = 30;
         BackpackManager.RemoveGrid();
         BackpackManager.instance.gridNum--;
         Debug.Log(collision.gameObject.name);
     }
 }
Exemplo n.º 2
0
    void Test()
    {
        //背包格子增加
        if (Input.GetKeyDown(KeyCode.Z))
        {
            BackpackManager.instance.backpack.GridGeneration();
            BackpackManager.RefreshItem();
            BackpackManager.instance.gridNum++;
        }
        // //放入随机物品
        // if (Input.GetKeyDown(KeyCode.X))
        // {
        //     BackpackManager.AddItem(5);
        // }
        // //背包格子减少
        if (Input.GetKeyDown(KeyCode.C))
        {
            BackpackManager.RemoveGrid();
            BackpackManager.instance.gridNum--;
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            BackpackManager.AddItem(1);
        }
        if (Input.GetKeyDown(KeyCode.V))
        {
            BackpackManager.AddItem(2);
        }
        //显示/隐藏背包
        if (Input.GetKeyDown(KeyCode.I))
        {
            backpackObj.SetActive(!backpackObj.activeSelf);
        }
        if (Input.GetKeyDown(KeyCode.P))
        {
            BackpackManager.AddItem(6);
        }
    }