void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            if (CompareTag("Wet") || CompareTag("Danger") || CompareTag("General") || CompareTag("Recycle"))
            {
                Debug.Log(tag);
                if (ItemMan.AddItem(tag))
                {
                    Destroy(gameObject);
                }
            }

            if (CompareTag("WetBin") || CompareTag("DangerBin") || CompareTag("GeneralBin") || CompareTag("RecycleBin"))
            {
                Debug.Log(tag);
                if (tag.Replace("Bin", "") == ItemMan.HoldItem)
                {
                    Player.AddScore(ScorePerPiece);
                    ItemMan.HoldItem = "";
                }
                else if (ItemMan.HoldItem != "")
                {
                    Player.AddScore(-WrongBin);
                    ItemMan.HoldItem = "";
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (sharedInstance == null)
        {
            sharedInstance = this;

            inventory = new InventorySystem();

            InventoryItem tempItem = new InventoryItem();
            tempItem.Category    = BaseItem.ItemCategory.Clothing;
            tempItem.Name        = "Capa de la abuela";
            tempItem.Description = "Capa que perteneció a tu abuela antes de fallecer";
            tempItem.Strength    = 0.5f;
            tempItem.Weight      = 0.1f;

            inventory.AddItem(tempItem);
        }
        else if (sharedInstance != this)
        {
            //Si me meto aquí, yo soy un segundo game master
            //diferente al original, al bueno, al sharedInstance
            Destroy(this);
        }

        MasterVolume(sharedInstance.GetComponent <AudioSource>().volume);

        DontDestroyOnLoad(this);
    }
Ejemplo n.º 3
0
    public IEnumerator GetItem()
    {
        InventorySystem.AddItem(item);
        yield return(PicUp(item.itemName));

        yield break;
    }
Ejemplo n.º 4
0
 private void Start()
 {
     foreach (Item i in items)
     {
         inventory.AddItem(i);
     }
     //inventory.AddItem(items[0]);
 }
Ejemplo n.º 5
0
    public void Customization()
    {
        СustomizationSystem cusmomizator = GameObject.Find("СustomizationSystem").GetComponent <СustomizationSystem>();

        head.GetComponent <MeshFilter>().mesh = cusmomizator.GetHead(humanType);
        Сlothes bodyClothes = cusmomizator.GetBody(humanType);

        inventory.AddItem(bodyClothes);
        body.GetComponent <SkinnedMeshRenderer>().sharedMesh = bodyClothes.GetMesh();
        rightHand = rightHand != null?Instantiate(cusmomizator.GetRightHand(humanType), rightHand.transform) : null;
    }
Ejemplo n.º 6
0
    public void Buy(Item item)
    {
        if (GameController.Money < item.price)
        {
            productDescription.text = "<color=red>お金がたりません</color>";
            return;
        }

        InventorySystem.AddItem(item);
        GameController.Money -= item.price;
        displayMoney.text     = GameController.Money.ToString();
    }
    void Update()
    {
        if (item1Check == true)
        {
            if (Input.GetKeyDown("space"))
            {
                Debug.Log("pressed for item1");

                inventory.AddItem(item1);
            }
        }
        if (item2Check == true)
        {
            if (Input.GetKeyDown("space"))
            {
                Debug.Log("pressed for item2");

                inventory.AddItem(item2);
            }
        }
        return;
    }
Ejemplo n.º 8
0
    private IEnumerator RewardItem()
    {
        Item item = BattleController.instance.GetRewardItem();

        if (item == null)
        {
            yield break;
        }
        InventorySystem.AddItem(item);
        string ms = "たからばこが おちている!\n" + item.itemName + "を てにいれた";

        yield return(BattleMessage.GetWindow().ShowClick(ms));

        yield break;
    }
Ejemplo n.º 9
0
 public void StoreItemInInventory(int itemCode)
 {
     if (itemCode == 0)
     {
         if (coinSystem == null)
         {
             Debug.LogWarning("No coin system instance...");
         }
         else
         {
             coinSystem.UpdateCoin(1);
         }
     }
     else
     {
         inventorySystem.AddItem(itemCode);
     }
 }
Ejemplo n.º 10
0
 void Update()
 {
     close = PlayerClose();
     if (PlayerClose())
     {
         if (Input.GetKeyDown("e"))
         {
             for (int i = 0; i < inventory.slots.Length; i++)
             {
                 if (!inventory.isFull[i])
                 {
                     Instantiate(imageItem, inventory.slots[i].transform, false);
                     inventory.AddItem(gameObject, i);
                     break;
                 }
             }
             Destroy(gameObject);
         }
     }
 }
Ejemplo n.º 11
0
    public void GetAllResorces(InventorySystem toInventory)
    {
        List <int> removeIndex = new List <int>();

        for (int i = 0; i < inventory.Count; i++)
        {
            if (inventory[i].GetType() == typeof(Resource))
            {
                toInventory.AddItem(inventory[i]);
                removeIndex.Add(i);
            }
        }
        for (int i = removeIndex.Count - 1; i >= 0; i--)
        {
            inventory.RemoveAt(removeIndex[i]);
        }
        if (inventory.Count < inventoryLenth)
        {
            isInventoryFull = false;
        }
    }
Ejemplo n.º 12
0
    private void Awake()
    {
        if (sharedInstance == null)
        {
            sharedInstance = this;
            inventory      = new InventorySystem();

            //
            InventoryItem tempItem = new InventoryItem();
            tempItem.Category = BaseItem.ItemCategory.Clothing;
            inventory.AddItem(tempItem);
            //
        }
        else if (sharedInstance != this)
        {
            Destroy(this);
        }

        MainVolume(sharedInstance.GetComponent <AudioSource>().volume);

        DontDestroyOnLoad(this);
    }
Ejemplo n.º 13
0
 public void PickUp()
 {
     invSys.AddItem(itemIndex);
     Destroy(gameObject);
 }
Ejemplo n.º 14
0
 //アイテム操作
 public void AddItem(int id)
 {
     InventorySystem.AddItem(id);
 }
        private void FixedUpdate()
        {
            PickupCheck();
            float speed;

            GetInput(out speed);
            if (Input.GetButton("Crouch"))
            {
                speed = speed / 2;
                transform.localScale = new Vector3(1, crouchHeight, 1);
            }
            else if (Input.GetButton("SlowWalk"))
            {
                speed = speed / 2;
            }
            if (!Input.GetButton("Crouch"))
            {
                transform.localScale = new Vector3(1, 1, 1);
            }
            if (Input.GetMouseButtonDown(0))
            {
                if (canPickup)
                {
                    inventory.AddItem(pickupItem);
                    pickupItem.gameObject.SetActive(false);
                }
                else if (canOpenDoor)
                {
                    if (!door.GetComponent <DoorControls>().unlocked)
                    {
                        door.GetComponent <DoorControls>().unlockDoor(gameObject);
                    }
                    else
                    {
                        door.GetComponent <DoorControls>().openDoor();
                    }
                }
            }

            // always move along the camera forward as it is the direction that it being aimed at
            Vector3 desiredMove = transform.forward * m_Input.y + transform.right * m_Input.x;

            // get a normal for the surface that is being touched to move along it
            RaycastHit hitInfo;

            Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out hitInfo,
                               m_CharacterController.height / 2f, Physics.AllLayers, QueryTriggerInteraction.Ignore);
            desiredMove = Vector3.ProjectOnPlane(desiredMove, hitInfo.normal).normalized;

            m_MoveDir.x = desiredMove.x * speed;
            m_MoveDir.z = desiredMove.z * speed;


            if (m_CharacterController.isGrounded)
            {
                m_MoveDir.y = -m_StickToGroundForce;

                if (m_Jump)
                {
                    m_MoveDir.y = m_JumpSpeed;
                    PlayJumpSound();
                    m_Jump    = false;
                    m_Jumping = true;
                }
            }
            else
            {
                m_MoveDir += Physics.gravity * m_GravityMultiplier * Time.fixedDeltaTime;
            }
            m_CollisionFlags = m_CharacterController.Move(m_MoveDir * Time.fixedDeltaTime);

            ProgressStepCycle(speed);
            UpdateCameraPosition(speed);

            m_MouseLook.UpdateCursorLock();
        }
        private void Start()
        {
            inventorySystem.AddItem(ItemType.AXE, 1);

            inventorySystem.AddItem(ItemType.RIFLE_AK74, 1);
            inventorySystem.AddItem(ItemType.PISTOL_M1911, 1);

            inventorySystem.AddItem(ItemType.AMMO_PISTOL, 100);

            inventorySystem.AddItem(BlockType.COBBLESTONE, 32);
            inventorySystem.AddItem(BlockType.DIRT, 32);
            inventorySystem.AddItem(BlockType.GRASS_BLOCK, 32);
            inventorySystem.AddItem(BlockType.OAK_LEAVES, 32);
            inventorySystem.AddItem(BlockType.OAK_LOG, 32);
            inventorySystem.AddItem(BlockType.OAK_PLANKS, 32);
            inventorySystem.AddItem(BlockType.OBSIDIAN, 32);
            inventorySystem.AddItem(BlockType.SAND, 32);
            inventorySystem.AddItem(BlockType.SPRUCE_LEAVES, 32);
            inventorySystem.AddItem(BlockType.SPRUCE_LOG, 32);
            inventorySystem.AddItem(BlockType.STONE, 32);
        }