Esempio n. 1
0
 // Start is called before the first frame update
 private void Awake()
 {
     inventory      = new Inventory(UseItem, this);
     craftInventory = new CraftableInventory(UseItem, this);
     uiInventory.SetInventory(inventory);
     uiCrafting.SetCraftInv(craftInventory);
     craftItems.SetCraftInv(craftInventory);
     craftItems.SetInv(inventory);
     uiCrafting.RefreshCraftables();
     myRenderer           = gameObject.GetComponent <SpriteRenderer>();
     shaderGUItext        = Shader.Find("GUI/Text Shader");
     shaderSpritesDefault = Shader.Find("Universal Render Pipeline/2D/Sprite-Lit-Default"); // or whatever sprite shader is being used
     state       = State.Normal;
     fifthHeight = theCamera.orthographicSize / 3;
     fifthWidth  = theCamera.orthographicSize * (Screen.width / Screen.height) / 3;
     lastMove    = new Vector2(0f, -1f);
     anim        = GetComponent <Animator>();
     myRigidbody = GetComponent <Rigidbody2D>();
     normalSprite();
     sfxMan = FindObjectOfType <SFXManager>();
     if (GameObject.FindGameObjectsWithTag("Player").Length > 1)
     {
         Object.Destroy(gameObject);
     }
     else
     {
         DontDestroyOnLoad(transform.gameObject);
     } // check if player exists in the scene already or not
     canMove = true;
 }
Esempio n. 2
0
 public void SetCraftInv(CraftableInventory craftInv)
 {
     this.craftInv = craftInv;
 }
Esempio n. 3
0
    // Start is called before the first frame update

    public void SetCraftInv(CraftableInventory craftInv)
    {
        this.craftInv = craftInv;
        craftInv.OnCraftableListChanged += CraftableInventory_OnCraftableListChanged;
        RefreshCraftables();
    }