예제 #1
0
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            DirtTile dirt = target.GetComponent <DirtTile>();
            if (dirt != null)
            {
                dirt.Interact(crop, tool, this);
            }

            TableTile table = target.GetComponent <TableTile>();
            if (table != null)
            {
                table.Interact(crop, tool, this);
            }

            TrashCan trashCan = target.GetComponent <TrashCan>();
            if (trashCan != null)
            {
                trashCan.Interact(crop, tool, this);
            }

            Truck truck = target.GetComponent <Truck>();
            if (truck != null)
            {
                truck.Interact(crop, this);
            }

            SeedBarrel barrel = target.GetComponent <SeedBarrel>();
            if (barrel != null)
            {
                barrel.Interact(crop, tool, this);
            }
        }
    }