コード例 #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name == "Grenade")
        {
            GameController.control.grenade = true;
        }
        if (other.name == "Shotgun")
        {
            GameController.control.shotgun = true;
        }
        if (other.name == "Shield")
        {
            GameController.control.shield = true;
        }
        if (other.name == "Staff")
        {
            GameController.control.staff = true;
        }
        if (other.name == "TimeStopWatch")
        {
            GameController.control.watch = true;
        }
        if (other.name == "NukaSoda")
        {
            GameController.control.soda = true;
        }
        if (other.name == "LaserCannon")
        {
            GameController.control.cannon = true;
        }



        InventoryItemBase item = other.GetComponent <InventoryItemBase>();

        if (item != null)
        {
            if (item.CanInteract(other))
            {
                mInteractItem = item;
                Hud.OpenMessagePanel(mInteractItem);
            }
        }
    }